随笔分类 - php
摘要:1.下载安装PhpStorm 先去官网下载,我这里下载的是最新版本的2023.1.2,测试过2023最新版本以及2021版本以上的版本没问题。 安装然后打开 点击next 我这里是全部勾选,然后next 安装好后打开 点exit先退出phpstorm 2.下载破解工具 下载破解工具激活为了防止爬虫,
阅读全文
摘要:调用方法 $file_log = [ 'order_id' => 123, ]; (new Logs('log'))->infos('日志文案', $file_log); [2023-12-14 15:24:13] [INFO] [log] {"msg":"日志文案","params":{"orde
阅读全文
摘要:bcadd — 加法,2个任意精度数字的加法计算 bcsub — 减法 bcmul — 乘法 bcdiv — 除法 bcpow — 乘方 bcmod — 取模 bcsqrt — 求二次方根 bccomp — 比较两个任意精度的数字,返回一个整数的结果:若两数相等返回0,左数大返回1,否则返回-1 b
阅读全文
摘要:依赖注入和控制反转说的其实是同一个东西,他们是一种设计模式,这种设计模式用来减少程序之间的耦合 依赖注入:依赖注入是从应用程序的角度来描述,即应用程序依赖容器创建并注入到他所需要的的外部资源 控制反转:是从容器的角度来描述,即容器控制应用程序,容器反向的向应用程序注入应用程序所需要的的外部资源 使用
阅读全文
摘要:public function get_client_ip($type = 0, $adv = false) { $type = $type ? 1 : 0; static $ip = NULL; if ($ip !== NULL) return $ip[$type]; if ($adv) { if
阅读全文
摘要:if(! mb_check_encoding($result, 'utf-8')) { $result = mb_convert_encoding($result,'UTF-8',['ASCII','UTF-8','GB2312','GBK']); }
阅读全文
摘要:Qiniu.php <?php namespace app\common\service; use Qiniu\Auth; use Qiniu\Storage\UploadManager; class Qiniu { const QINIU_URL = ''; const ACCESS_KEY =
阅读全文
摘要:stripslashes(trim(str_replace(array("\r\n", "\r", "\n", " ","'"), "", $strng)))
阅读全文
摘要:$color = $this->dominant_color($img); //获取图片颜色 $water = $this->make_watermark_img('水印文字', $color); //生成水印图片 $this->add_img_water($file_path, $water['u
阅读全文
摘要:/** * 裁剪图片 * imageCropper * @param string $source_path 图片地址 * @param string $w_file_path 要保存的地址 */ public function imageCropper($source_path, $w_file_
阅读全文
摘要:/** *获取指定一段时间内的每天的开始时间 * @param $startdate 开始日期 时间戳 * @param $enddate 结束日期 时间戳 * @param $format 时间格式 0:时间戳 1日期格式 * @return array 返回一维数组 */ public stat
阅读全文
摘要:/* * 截取字符串 */ public static function cut($begin,$end,$str){ $b = mb_strpos($str,$begin) + mb_strlen($begin); $e = mb_strpos($str,$end) - $b; return mb
阅读全文
摘要:/* * 生成水印logo * text 水印文字 bigImgPath 背景图 */ public static function make_watermark_img($text, $bigImgPath) { if (strtoupper(substr(PHP_OS,0,3)) 'WIN')
阅读全文
摘要:/** * @NodeAnotation(title="更新类节点") * @FunctionName:putTex * @User: hdd * @Date: 2021/11/26 0026 15:04 */ public function putTex() { // 获取当前文件的上级目录 $c
阅读全文
摘要:/** * 根据地址获取经纬度 */ public static function getLoaction($local) { $address = urlencode($local[0].$local[1]); $url = "https://apis.map.qq.com/jsapi?qt=ge
阅读全文