分类 Laravel 对应的文章如下

Mac安装Swoole扩展phpize 时 Cannot find autoconf 解决方法swoole-1.9.23 phpizeConfiguring for:PHP Api Version:         20131106Zend Module Api No:      20131226Zend Extension Api No:   220131226Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment var...

阅读全文 »

Mac PHP5.6.30编译安装swoole扩展,安装完成之后,执行命令:lib git:(stable) php -v                PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php56/5.6.30_6/lib/php/extensions/no-debug-non-zts-20131226/swoole.so' - dlopen(/usr/local/Cellar/php56/...

阅读全文 »

Laravel 事务手动使用事务://Controller控制器顶部  use LeagueFlysystemException;//实际执行使用代码: //执行sql操作    DB::beginTransaction();    try {        // 保存车辆信息        ...

阅读全文 »

用PHP信贷业务中使用的 等额本息、等额本金信贷计算,PHP代码代码如下:/**  * 等额本息还款法  * @param int $loanPeriod  * @param int $loanTotal  * @param float $loanRate  */ public function fixedInstallment() {     $loanPeriod&nb...

阅读全文 »

Laravel 关闭过滤排除部分路由VerifyCsrfToken 验证官方接口设置:Laravel的VerifyCsrfToken防范是通过app/http/Middleware目录下的中间件VerifyCsrfToken.php来生效验证的.如下所示在官方代码中有个属性$except,可以专门用来设置哪些路由不用做csrf验证;<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\Ve...

阅读全文 »

前几日开始断断续续在看Laravel5.5 发现其中有个扩展包,针对现有的项目缺陷很有参考价值。Laravel Horizon监控你的Redis队列。Horizon 可以帮助你轻松实现对 Redis 队列系统的一些关键指标的监控,例如作业吞吐量,运行时间等。资料目前不太多,先简单整理下mark首先说明下此扩展包只支持PHP7.1以上,Laravel5.5框架。原计划在Laravel5.2上尝试失败。。一...

阅读全文 »

Laravel 的任务调度——计划任务版本:Laravel 5.2Laravel这个任务调度功能最大了优势就在于增加任务时不需要SSH到服务器增加Cron条目。但前期准备工作还是必须要加入一条Cron的。1、服务器相关配置:准备工作:启动调度器ssh 到服务器或者直接在本地环境 终端中输入命令:#  crontab -e  解释下这个命令:实际作用就是在服务器的/var/spool/cro...

阅读全文 »

laravel 处理传参时报错 Illegal string offsetErrorException in TestController.php line 1670:Illegal string offset 'id'于是乎我接收打印了了下数据:$input = Request::input();
dd($input);结果:array(3) { [0]=> array(14) { ["id"]=> int(85)  } [1]=> array(14) { ["id"]=> int(86) } ["s"]=> string(37) “/Test/save...

阅读全文 »

larval 模板blade报错信息:ErrorException in helpers.php line 531:htmlentities() expects parameter 1 to be string, array given (View: /test/resources/views/edits.blade.php)模板标签写法: {{$imgArr}}其实很明显的错误,htmlentities()第一个参数是字符串,给的是数组。模版{{}}不接受直接赋值的数组数据,需要是个字符串...

阅读全文 »

laravel 渲染页面 页面空白,控制台报500错误。路由return view(“welcome”),报500错误,Failed to load resource: the server responded with a status of 500 (Internal Server Error)准备看log日志竟然没生成日志。直接在路由中return “asss”字符串,Route::get('/', function () {    return “asss”;
  &nbs...

阅读全文 »

很多时候我们想得到最后一条数据库语句,那么php - laravel 5.1 如何打印最后一次执行的sql ,laravel ORM怎么打印出执行sql语句呢model内部方法内容:/** * 根据条件查询*/public function getDataByCondition($condition = []){$this->getconnection()->enableQueryLog(); //开启日志$_m = $this->select('id', &...

阅读全文 »

curl_setopt函数相关应用及介绍一、要想使用curl_setopt 这个函数必须在服务器里边进行编译curl这个组件,怎么安装编译这个组件请具体到google搜索二、curl_setopt的php帮助文档的解释bool curl_setopt (int ch, string option, mixed value) curl_setopt()函数将为一个CURL会话设置选项。option参数是你想要的设置,value是这个选项给定的值。下列选项的...

阅读全文 »

preg_replace(): Parameter mismatch, pattern is a string while replacement is an array error数组不对

阅读全文 »

DB::connection()->enableQuerylog();                $brokeList = DB::table('broke')->where(['brand_id' => 1, 'firm_id' => 0])        ->orWhere(function($query){            ...

阅读全文 »

概述 队列概念:版本:laravel version:5.1消息队列的理解Laravel 队列服务为各种不同的后台队列提供了统一的 API。队列允许你推迟耗时任务(例如发送邮件)的执行,从而大幅提高 web 请求速度。laravel实现的消息队列 1、配置:· 为了更直观的看到队列执行的过程及结果,我们采用数据库驱动。打开 config/queue.php,更改默认队列...

阅读全文 »