Laravel
顾米楠
哇咔咔咔
展开
-
php读取日志文件
荆轲刺秦王需要参数: 1:文件路径 2:行数 读多少行 如果输入的行数大于文件实际行数 则读出全部文件function tailFile( $file, $lines ) { $handle = fopen($file, "r"); $linecounter = $lines; $pos = -2; $beginning = false; $text = []; while ($linecoun原创 2021-04-23 14:21:11 · 463 阅读 · 0 评论 -
php 循环foreach时,数据格式不对报错
荆轲刺秦王先看一下数据:Array( [0] => Array ( [coupon_id] => 475 [coupon_name] => 测试coupon_name [image_url] => xxx.jpg [total_count] => 10000 [point_exchange] => 3000原创 2021-02-20 15:23:54 · 390 阅读 · 0 评论 -
laravel导入
荆轲刺秦王public function storeGroupImport( Request $request , StoreGroupDao $storeGroupDao ) { $nodeId = txt_filter($request -> get('node_id')); $brandId = txt_filter($request -> get('brand_id')); $file = $request->file(原创 2020-11-18 16:54:59 · 279 阅读 · 0 评论 -
Laravel 更换内置服务器监听端口
荆轲刺秦王正常情况下,使用 php artisan serve 启动 Laravel 内置服务器,将会监听在 localhost 的 8000 端口上php artisan serveLaravel development server started on http://localhost:8000我在启动的时候发现监听的端口是:8001 ,这个时候最好先看一下 8000 端口有没有被占用如图: netstat -ano |findstr "8000" 发现并没有被别的应用占用,.原创 2020-10-22 10:09:06 · 628 阅读 · 0 评论 -
Laravel 7 常用封装函数
荆轲刺秦王对于用户输入的值永远是需要过滤处理的,为了避免每次都要重新写,就直接写到 lib/function.php 中。<?phpif (!function_exists('log_write')) { /** * 日志打印 * * @param $content * @param string $logName */ function log_write($content, $logName = '',.原创 2020-09-14 17:08:06 · 305 阅读 · 0 评论 -
Laravel7关联查询将一个字段中以逗号分隔的取出来形成新的字段
荆轲刺秦王先看一下表结构:最终结果要第一张表的数据,第一张表的data 中的字段对应的是 key,业务需要的是第二张表的 name先看需要引入的文件:主要是model文件use Illuminate\Support\Facades\DB;use App\Model\SystemEvent;use App\Model\SystemEventParam;use Lib\PublicClass\S;然后看第一种解决方案:public function getEve...原创 2020-09-04 16:37:44 · 1513 阅读 · 0 评论 -
表单数据过滤
荆轲刺秦王在实际项目中,对于用户提交的表单信息要做过滤,为了省事,将封装好的函数放到这里先上公共函数:if(! function_exists('array_txt_filter')) { /** * 过滤html标签sql注入 仅支持规则的一二维数组,字符串 * @param $param array|string * @return $param */ function array_txt_filter($param) {原创 2020-09-01 16:27:44 · 361 阅读 · 0 评论