随笔分类 -  PHP

摘要:源代码 $proArr = array( array('id'=>1,'name'=>'特等奖','v'=>1), array('id'=>2,'name'=>'一等奖','v'=>222), array('id'=>3,'name'=>'二等奖','v'=>333), array('id'=>4, 阅读全文
posted @ 2020-07-18 17:28 办公魔盒 阅读(172) 评论(0) 推荐(0)
摘要:源代码 /** * 验证码 */ public function getCode($num = "4", $w = "80", $h = "26") { $str = Array(); //用来存储随机码 $vcode = ""; $string = "ABCDEFGHIJKLMNPQRSTUVWX 阅读全文
posted @ 2020-07-18 17:25 办公魔盒 阅读(155) 评论(0) 推荐(0)
摘要:源代码 public function moreimgupload() { $htmlfilename = 'files'; $new_folder='../../../www/data/upload/'; $allow_ext = array('jpg', 'jpeg', 'png', 'gif' 阅读全文
posted @ 2020-07-18 17:24 办公魔盒 阅读(136) 评论(0) 推荐(0)
摘要:源代码 function get_curr_time_section() { $checkDayStr = date('Y-m-d ',time()); $timeBegin1 = strtotime($checkDayStr."09:00".":00"); $timeEnd1 = strtotim 阅读全文
posted @ 2020-07-18 17:23 办公魔盒 阅读(326) 评论(0) 推荐(0)
摘要:源代码 /** * 计算两个时间戳之间相差的日时分秒 * @param $begin_time 开始时间戳 * @param $end_time 结束时间戳 * @return array */ function timediff($begin_time,$end_time) { if($begin 阅读全文
posted @ 2020-07-18 17:22 办公魔盒 阅读(2154) 评论(0) 推荐(0)
摘要:源代码 判断时间 if(date('Y-m-d')==date('Y-m-d', strtotime($res[0]->createtime))){ $finance_day_num+=1; $finance_day_money+=$res[0]->payamount; } 阅读全文
posted @ 2020-07-18 17:21 办公魔盒 阅读(397) 评论(0) 推荐(0)
摘要:源代码 //判断是否是微信浏览器 function isWeixin() { if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { return true; } else { return false; } } 阅读全文
posted @ 2020-07-18 17:20 办公魔盒 阅读(401) 评论(0) 推荐(0)
摘要:源代码 设置脚本运行时间 ini_set('max_execution_time', '0');//永久 阅读全文
posted @ 2020-07-18 17:19 办公魔盒 阅读(163) 评论(0) 推荐(0)
摘要:源代码 /** * 缩放图片 * @param $filename 图片地址 * @param $per 缩放倍数 1.2 0.3 * @return string */ private function scaleImg($filename,$per){ $per_str=implode('_', 阅读全文
posted @ 2020-07-18 17:18 办公魔盒 阅读(127) 评论(0) 推荐(0)
摘要:源代码 get请求 function mcurl_get($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); cur 阅读全文
posted @ 2020-07-18 17:17 办公魔盒 阅读(193) 评论(0) 推荐(0)
摘要:相关方法 //判断某个字符是否在数组内 bool in_array ($needle,$array [,strict]) //例子: //分割字符串 preg_split(); //例子: $str='1,2,3,4'; preg_split('/,/',$str); //求数组交集,并集,差集 a 阅读全文
posted @ 2020-07-18 17:16 办公魔盒 阅读(110) 评论(0) 推荐(0)
摘要:源代码 $link='http://www.baidu.com?article_id=123'; //app内链接 返回article_id 和article_anew_id function convertUrlQuery($query) { $queryParts = explode('&', 阅读全文
posted @ 2020-07-18 17:15 办公魔盒 阅读(298) 评论(0) 推荐(0)
摘要:源代码 post请求json中文字符被转码 //强制不转码 json_encode($json,JSON_UNESCAPED_UNICODE) 阅读全文
posted @ 2020-07-18 17:14 办公魔盒 阅读(736) 评论(0) 推荐(0)
摘要:源代码 /** * 检查ip是否在允许范围 * @param $host_ip * @return bool */ private function checkIP($host_ip){ $alip = '192.1.*.*'; $start_ip = $alip; foreach ($alip a 阅读全文
posted @ 2020-07-18 17:13 办公魔盒 阅读(312) 评论(0) 推荐(0)
摘要:php 图片合成 public function shareimg() { $id = $_POST['uid']; //二维码图片 $qrodeimg = $this->getWxappQrCode($id); //背景图片 $bannerimg = ROOT_PATH . '/public/wx 阅读全文
posted @ 2020-07-18 17:12 办公魔盒 阅读(207) 评论(0) 推荐(0)
摘要:源代码 $z = date('Y-m'); $a = date('Y-m', strtotime('-12 months')); $begin = new DateTime($a); $end = new DateTime($z); $end = $end->modify('+1 month'); 阅读全文
posted @ 2020-07-18 17:11 办公魔盒 阅读(1068) 评论(0) 推荐(0)
摘要:源代码 Hmac加密 private function computeSignature($accessSecret, $canonicalString) { $s = hash_hmac('sha256', $canonicalString, $accessSecret, true); retur 阅读全文
posted @ 2020-07-18 17:10 办公魔盒 阅读(248) 评论(0) 推荐(0)
摘要:源代码 /** * post请求 * @param $url * @param $postdata * @return mixed */ function get_component($url,$postdata){ $ch = curl_init(); //用curl发送数据给api curl_s 阅读全文
posted @ 2020-07-18 17:08 办公魔盒 阅读(215) 评论(0) 推荐(0)
摘要:源代码 /** * 百度地图经纬度转腾讯地图经纬度 * @param $lat * @param $lon * @return string */ public function map_bd2tx($lat, $lon) { $tx_lat = 0; $tx_lon = 0; $x_pi = 3. 阅读全文
posted @ 2020-07-18 17:07 办公魔盒 阅读(429) 评论(0) 推荐(0)
摘要:源代码 获取区域网IP地址 $host_name = exec("hostname"); $host_ip = gethostbyname($host_name); //获取本机的局域网IP echo $host_ip; 阅读全文
posted @ 2020-07-18 17:06 办公魔盒 阅读(241) 评论(0) 推荐(0)