随笔分类 -  PHP函数

摘要:if (strpos($employee['avatar'], 'http') !== false) { // 获取https头像 取消ssl验证 $arrContextOptions = [ "ssl" => [ "verify_peer"=>false, "verify_peer_name"=> 阅读全文
posted @ 2019-06-17 14:07 迷失在路上 阅读(1780) 评论(0) 推荐(1) 编辑
摘要:preg_quote 转义正则表达式字符(向正则表达式语法中的字符前增加一个反斜线)(如下的例子中则是将*very*变成\*very\*),返回转义后的字符串。 $textbody = "This book is *very* difficult to find."; $word = "*very* 阅读全文
posted @ 2019-03-06 09:05 迷失在路上 阅读(130) 评论(0) 推荐(0) 编辑
摘要:主要函数有:bcadd — 将两个高精度数字相加bccomp — 比较两个高精度数字,返回-1, 0, 1bcdiv — 将两个高精度数字相除bcmod — 求高精度数字余数bcmul — 将两个高精度数字相乘bcpow — 求高精度数字乘方bcpowmod — 求高精度数字乘方求模,数论里非常常用 阅读全文
posted @ 2019-02-28 17:58 迷失在路上 阅读(415) 评论(0) 推荐(0) 编辑
摘要:function to_unicode($string) { $str = mb_convert_encoding($string, 'UCS-2', 'UTF-8'); $arrstr = str_split($str, 2); $unistr = ''; foreach ($arrstr as 阅读全文
posted @ 2019-02-25 09:23 迷失在路上 阅读(1156) 评论(0) 推荐(0) 编辑
摘要:$compare= 1; $arrLis = array(1,2,3,4,5,'-1'); $arr = array_filter($arrLis,function($param) use ($compare) { return $param> $compare; }) $param 为 $arrL 阅读全文
posted @ 2018-08-17 16:50 迷失在路上 阅读(181) 评论(0) 推荐(0) 编辑
摘要:使用的 php_sdk_v4 https://github.com/tencentyun/cos-php-sdk-v4 使用框架 TP3.2 首先将sdk 放置Org/Net目录下 修改sample.php 为Cos.class.php 文件名称无所谓 这样就可以直接在 控制器中调用 阅读全文
posted @ 2018-08-10 16:49 迷失在路上 阅读(319) 评论(0) 推荐(0) 编辑
摘要:闲话不唠 直接上代码 使用 put方式的js_web上传方式 使用的基本是demo里的东西,在官方也有着地址 https://github.com/tencentyun/cos-js-sdk-v5/tree/master/demo 这里只要讲下配置 以下是php代码 <?phpnamespace H 阅读全文
posted @ 2018-08-09 17:53 迷失在路上 阅读(2298) 评论(0) 推荐(0) 编辑
摘要:get_object_vars 阅读全文
posted @ 2018-07-25 15:03 迷失在路上 阅读(176) 评论(0) 推荐(0) 编辑
摘要:function get_client_ip(){ if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif(ge 阅读全文
posted @ 2018-07-25 14:19 迷失在路上 阅读(3297) 评论(0) 推荐(0) 编辑
摘要:getenv 取得系统的环境变量\ string getenv( string varname ) 参数 varname 应该是$_SERVER(服务器超级全局变量数组) 中预订的元素索引名, 或者是用putenv('new = very new') 定义一下new 为环境变量,所以new作为参数将 阅读全文
posted @ 2018-03-13 10:14 迷失在路上 阅读(10089) 评论(0) 推荐(0) 编辑
摘要:1. php类中,静态方法调用当前类的非静态方法必须用self关键字,不能用$this 2. php类中,公有方法调用私有方法使用$this关键字,只能实例化调用 3. php类中,公有方法调用私有方法使用self关键字,此共有方法自动转化为静态方法 4. php类中,静态方法不能调用非静态属性。因 阅读全文
posted @ 2017-08-17 17:17 迷失在路上 阅读(125) 评论(0) 推荐(0) 编辑
摘要:public function download($url,$token) { $ch = curl_init ($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 返回的内容作为变量储存,而不是直接输出 设为1 或者 true curl_s... 阅读全文
posted @ 2017-08-09 10:15 迷失在路上 阅读(181) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示