随笔分类 -  PHP

1 2 3 4 5 ··· 7 下一页
摘要:直接上代码 <?php ### 如何避免在foreach 里查询数据库 /** * 场景: * 商品表: goods * goods_id 商品ID * goods_name 商品名称 * brand_id 品牌id * 品牌表: brand * brand_id * brand_name **/ 阅读全文
posted @ 2021-06-04 09:35 依然范儿特西 阅读(497) 评论(0) 推荐(1) 编辑
摘要:优点: 缩略图的速度非常快,质量非常高 支持智能剪裁 很好的支持GIF图片 5种缩略图模式 图像对比功能 图像高级过滤功能 图像混合 其他图像处理库支持的API基本都支持 安装 下载 1、直接下载: Grafika的官网:https://kosinix.github.io/grafika/ Gith 阅读全文
posted @ 2021-03-10 17:12 依然范儿特西 阅读(525) 评论(0) 推荐(0) 编辑
摘要:1 查看配置 composer config -l -g 2 找到 home 参数 3 进入home参数指向的位置 编辑 config.json config":{"secure-http":false} 阅读全文
posted @ 2021-03-09 13:00 依然范儿特西 阅读(591) 评论(0) 推荐(1) 编辑
摘要:从node里搬来一个 签名运算, JS:731740861 ^ 2746333894 = -2010333061 到php 里 进行运算,结果不一致 731740861 ^ 2746333894 = 2284634235 解决办法: function bit_xor() { $arr = func_ 阅读全文
posted @ 2021-03-05 09:18 依然范儿特西 阅读(79) 评论(0) 推荐(0) 编辑
摘要:代码基于thinkphp, linux环境,php7.2 亲测了100万数据 命令 php /home/data/laofan/public/index.php index/test/run 1>/home/data/laofan/public/run.log 2>/home/data/laofan 阅读全文
posted @ 2021-01-06 11:00 依然范儿特西 阅读(541) 评论(0) 推荐(0) 编辑
摘要:PHP 中 CLI模式下接收参数的三大方式 1 argv 方式 php test.php news 1 5 //变量仅在 register_argc_argv 打开时可用。 print_r($argc); //CLI下获取参数的数目,最小值为1 print_r($argv); //CLI下传递给脚本 阅读全文
posted @ 2021-01-05 15:56 依然范儿特西 阅读(844) 评论(0) 推荐(0) 编辑
摘要:函数对0的判断 $cast_id = 0; var_dump(strlen($cast_id)); //1 var_dump(empty($cast_id)); // true var_dump(isset($cast_id)); //true var_dump(is_null($cast_id)) 阅读全文
posted @ 2020-12-24 15:55 依然范儿特西 阅读(939) 评论(0) 推荐(0) 编辑
摘要:上代码 <?php /** * 分布式 id 生成类 组成: <毫秒级时间戳+机器id+序列号> * 默认情况下41bit的时间戳可以支持该算法使用到2082年,10bit的工作机器id可以支持1023台机器,序列号支持1毫秒产生4095个自增序列id * @author zhangqi */ cl 阅读全文
posted @ 2020-12-02 15:05 依然范儿特西 阅读(226) 评论(0) 推荐(0) 编辑
摘要:什么是威尔逊区间? 此处省略一万多个字 假设你已经是个成熟的程序猿了。不需要给你说理论了。。直接上代码吧 php版本 echo wilsonScore_2(300, 13/300, 2); function wilsonScore_2($n, $p, $z){ $a_1 = ((1 / (2 * $ 阅读全文
posted @ 2020-12-02 09:43 依然范儿特西 阅读(916) 评论(0) 推荐(1) 编辑
摘要:github: https://github.com/tecnickcom/TCPDF 将字体复制到TCPDF\tools 目录下 打开CMD窗口定位到 vendor\tecnickcom\TCPDF\tools 目录 执行下面的命令 我们以微软雅黑字体为例 php ./tcpdf_addfont. 阅读全文
posted @ 2020-11-27 13:32 依然范儿特西 阅读(436) 评论(0) 推荐(0) 编辑
摘要:直接上代码吧。全局路由中间件 <?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate 阅读全文
posted @ 2020-10-19 17:14 依然范儿特西 阅读(1215) 评论(0) 推荐(0) 编辑
摘要:在数据查询时候,多条件查询,使用场景 //单个值 $data_where['id'] = 1 // in 条件 写法一 $ids = [1,2,3,4,5]; $data_where[] = [DB::raw("字段名 in ({$ids})"),'1']; //in条件写法二 $data_wher 阅读全文
posted @ 2020-10-18 19:22 依然范儿特西 阅读(657) 评论(0) 推荐(0) 编辑
摘要:PHP 7 以下版本使用 set_error_handler 捕获异常 <?php error_reporting(E_ALL); set_error_handler('handle_error'); function handle_error($no,$msg,$file,$line){ // 执 阅读全文
posted @ 2020-10-09 19:21 依然范儿特西 阅读(298) 评论(0) 推荐(0) 编辑
摘要:1 application 下 新建文件 common/sys_func.php 写入代码 <?php //测试一下 function sys_test(){ return 'laofan'; } 2 在 application/Bootstrap.php 文件加入 public function 阅读全文
posted @ 2020-09-28 17:47 依然范儿特西 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Yaf的配置文件放在 基础目录结构的位置是: /conf/application.ini 读取 ,任意位置写入以下代码, $config = new Yaf_Config_ini(APPLICATION_PATH.'/conf/application.ini'); $laofan = $config 阅读全文
posted @ 2020-09-28 17:42 依然范儿特西 阅读(505) 评论(0) 推荐(0) 编辑
摘要:为大家提供一个网址,Laravel速查表(包含5.1、5.8、6.0、7.x) https://learnku.com/docs/laravel-cheatsheet/5.8/ 希望这篇文章能够帮助大家,如果有问题,请大家留言!!! Artisan常用命令 1、路由(route)相关操作 php a 阅读全文
posted @ 2020-09-25 09:38 依然范儿特西 阅读(504) 评论(0) 推荐(0) 编辑
摘要:背景 Laravel 中一般都是用 ORM 操作数据库的,但是遇到批量操作很多数据的时候如果还是使用 ORM 对象进行 save() 则会造成数据库压力过大,增加没必要的消耗。 具体实现 该方法是 Laravel 5.8 版本基础上修改的,其他版本或者其他框架则需要灵活调整。 基本思路是把二维数组进 阅读全文
posted @ 2020-09-25 09:35 依然范儿特西 阅读(4018) 评论(0) 推荐(0) 编辑
摘要:1 添加一个日志通道 : 打开 config/logging.php 'sql'=>[ 'driver' => 'daily', 'level' => 'debug', 'path' => storage_path('logs/sql/log.log'), ], 2 创建监听器 php artisa 阅读全文
posted @ 2020-09-23 10:13 依然范儿特西 阅读(374) 评论(0) 推荐(0) 编辑
摘要:github地址: https://github.com/PHPMailer/PHPMailer A开头: $AltBody --属性 出自:PHPMailer : $AltBody 文件:class.phpmailer .php 说明:该属性的设置是在邮件正文不支持HTML的备用显示 AddAdd 阅读全文
posted @ 2020-08-14 15:48 依然范儿特西 阅读(505) 评论(0) 推荐(0) 编辑
摘要:1 文件路径: app/Request.php <?php namespace app; // 应用请求对象类 class Request extends \think\Request { protected $filter = ['htmlspecialchars']; /***获取当前的应用名称 阅读全文
posted @ 2020-06-23 16:24 依然范儿特西 阅读(1166) 评论(0) 推荐(1) 编辑

1 2 3 4 5 ··· 7 下一页
点击右上角即可分享
微信分享提示