随笔分类 -  PHP

摘要:调用淘宝接口,获取 $ip='183.16.198.102';$json=file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip);$arr=json_decode($json);echo $arr->data-> 阅读全文
posted @ 2016-10-25 16:40 多多喜 阅读(2739) 评论(0) 推荐(2)
摘要:使用php自带函数,效率更佳。故将平时使用过的,记录。 1.array_search array_search — 在数组中搜索给定的值,如果成功则返回相应的键名 ,否则返回 FALSE 阅读全文
posted @ 2016-09-28 14:55 多多喜 阅读(227) 评论(0) 推荐(0)
摘要:1 标题 23 $field => 列名称 24 $data => 数据 25 $sheetindex => 第几个工作表) 26 * 27 */ 28 public static function getexportsheet($title,$field,$data,$sheetin... 阅读全文
posted @ 2016-08-25 12:16 多多喜 阅读(510) 评论(0) 推荐(0)
摘要:1 /** 2 * 获取用户真实IP 3 * @return $onlineIp 4 */ 5 public function getOnlineIp() 6 { 7 if (getenv('HTTP_CLIENT_IP')) { 8 $onlineIp = getenv('HTTP_CLIEN... 阅读全文
posted @ 2016-04-27 12:17 多多喜 阅读(294) 评论(0) 推荐(0)
摘要:1 urlencode_array($postData); 16 $postData['sign'] = md5(implode('', $postData) . md5('!!wxpay!!')); 17 return $url . '?' . http_build_query($postData); 18 } 19 20 // ... 阅读全文
posted @ 2016-04-19 10:31 多多喜 阅读(5642) 评论(2) 推荐(0)
摘要:urlencode:编码 URL 字符串 手册上是这样解释的: 返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+)。此编码与 WWW 表单 POST 数据的编码方式是一样的,同时与 application/x-www-for 阅读全文
posted @ 2016-04-19 10:24 多多喜 阅读(4370) 评论(2) 推荐(1)
摘要:1 public function json_encode($array) 2 { 3 $returnStr = ''; 4 $str = @json_encode($array); 5 if (preg_match_all("/\\\u[a-z0-9]{4}|[\w\W]+/U", $str, $matchs)) { 6 ... 阅读全文
posted @ 2016-04-08 12:02 多多喜 阅读(1537) 评论(0) 推荐(0)