随笔分类 - php
trae,qcode,phpstorm开启调式运行xdebug
摘要:1,window开启phpstudy的xdebug扩展,mac自行安装xdebug扩展 2,检查端口 3,配置文件 [Xdebug] zend_extension=D:/phpstudy_pro/Extensions/php/php7.3.9nts/ext/php_xdebug.dll xdebug
阅读全文
当写脚本循环更新几百万数据发现很慢怎么办
摘要:1. 核心逻辑:CASE WHEN条件更新 UPDATE table SET order_items_id = CASE WHEN stock_out_item_id = 1 THEN 100 WHEN stock_out_item_id = 2 THEN 200 ELSE order_items_
阅读全文
laravel中代码中终止执行reponse直接返回结果
摘要:response()->json([ 'code' => 5, 'msg' => sprintf("商品编码:%s,没有查询到可解锁的库存", $goodsSn), 'data' => [] ])->send(); exit;
阅读全文
php-laravel敏捷开发代码
摘要:1,新增 use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Validator; use App\Http\Utils\ValidatorMsg; use A
阅读全文
再B端业务中出现重复数据,并发操作处理思路
摘要:需求背景: 入库单号:L-ASN202502270728 入库批次号:100025022800151 数量:500 理货后,生成了一个500的已理货数据,上架后,生成了两个500已上架数据,重复了 以php项目为例 php-laravel框架 1,通过url+请求参数进行加锁处理 可以组织90%以上
阅读全文
php usort() 根据预先数组字段值排序数组
摘要:<?php function my_sort($a,$b) { if ($a==$b) return 0; return ($a<$b)?-1:1; } $a=array(4,2,8,6); usort($a,"my_sort"); ?> 2 4 6 8 2, 返回: ,3, $a = [ 0 =>
阅读全文
php后台管理系统laravel7.2以上异常发送钉钉告警提醒
摘要:1,\app\Http\Middleware\目录下新增文件Monitor.php <?php namespace App\Http\Middleware; use Error; use Closure; use Exception; use Illuminate\Http\Request; use
阅读全文
larave模板中使用layui模板语法
摘要:<script id="tbmpl" type="text/html"> <%# layui.each(d.list, function(index, item){ %> <tr class="cgdAddTr datatr" frq_id="<%# item.frq_id %>"> <td cla
阅读全文
layui中输出php的json数组对象
摘要:<script> var cangku = {!!json_encode(config('field.Warehouse'))!!}; console.log(cangku);</script>
阅读全文
window安装php的mongodb扩展
摘要:查看phpinfo(); https://pecl.php.net/package/mongo mongo驱动选择1.6.0的版本 https://pecl.php.net/package/mongodb mongodb 1.1.8 for Windows 打开php.ini 找到位置添加 exte
阅读全文
获取小程序的手机号
摘要:* -41001: encodingAesKey 非法 * -41003: aes 解密失败 * -41004: 解密后得到的buffer非法 * -41005: base64加密失败 * -41016: base64解密失败 * */ class ErrorCode { public static $OK = 0; publ...
阅读全文
php 简单加密解密
摘要:0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16) ) { return substr($result, 26); } else { return ''; } ...
阅读全文
浙公网安备 33010602011771号