摘要: concat可以在某字段前添加东西 concat('要添加的字符串',字段名); 阅读全文
posted @ 2017-12-13 10:41 码猿人 阅读(116) 评论(0) 推荐(0) 编辑
摘要: function xmltoarr($path){//xml字符串转数组 $xmlfile = file_get_contents($path);//提取xml文档中的内容以字符串格式赋给变量 $ob= simplexml_load_string($xmlfile,'SimpleXMLElement 阅读全文
posted @ 2017-12-07 14:07 码猿人 阅读(2952) 评论(0) 推荐(0) 编辑
摘要: php使用json_encode()把数组转换为json的时候,总会把中文进行转码,转码后从json数据上我们无法看出其中的中文文字。php5.4以后,当json_encode()的第二个参数赋值为JSON_UNESCAPED_UNICODE的时候则不对中文进行转码。 阅读全文
posted @ 2017-09-19 10:25 码猿人 阅读(856) 评论(0) 推荐(0) 编辑
摘要: /** * 判断是否微信 * liangzheng 2014-12-03 */ protected function is_weixin(){ if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) { retur 阅读全文
posted @ 2017-08-22 10:43 码猿人 阅读(126) 评论(0) 推荐(0) 编辑
摘要: /** * 数组转换为xml * * @param array $arr * @param int $level * @return string */ public static function arrayToXml($arr, $level = 0) { $s = $level == 0 ? 阅读全文
posted @ 2017-08-07 08:53 码猿人 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 流程说明 (1). 第三方发起微信授权登录请求,微信用户允许授权第三方应用后,微信会拉起应用或重定向到第三方网站,并且带上授权临时票据code参数; https://open.weixin.qq.com/connect/oauth2/authorize?appid=WX_APPID&redirect 阅读全文
posted @ 2017-08-04 17:03 码猿人 阅读(267) 评论(0) 推荐(0) 编辑
摘要: <?php class Curl { private $ch; private $url; public function __construct(){ $this -> ch = curl_init(); } /** * 设置一个请求链接 * @param String $url 请求的地址 */ 阅读全文
posted @ 2017-07-29 17:54 码猿人 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 1直接做个超链接,地址为文件的地址 <a href="文件地址">下载</a> 这种方法只能下载浏览器不能解析的文件,比如rar啊,脚本文件之类。如果文件是图片或者txt文档,就会直接在浏览器中打开 2流输出 <?php $file=fopen('文件地址',"r"); header("Conten 阅读全文
posted @ 2017-07-27 13:44 码猿人 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 获取这个星期周一到周日的时间戳 $timestr = time(); $now_day = date('w',$timestr); $sunday_str = $timestr - $now_day*60*60*24;//周一的时间戳 $strday_str = $timestr + (6-$now 阅读全文
posted @ 2017-07-26 17:22 码猿人 阅读(133) 评论(0) 推荐(0) 编辑
摘要: /* get请求 */ function getcurl($url,$type=false,$data=''){ $ch = curl_init(); //设置选项,包括URL curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_ 阅读全文
posted @ 2017-07-24 17:19 码猿人 阅读(281) 评论(0) 推荐(0) 编辑