当你安装一个软件的成功时候,会返回软件的安装路径,找到这个软件包(以git为例)的bin路径,执行
exprot path=/usr/local/git/bin
或者把软件复制到 /usr/bin
cp /usr/local/git /usr/bin
这样就可以全局使用这个命令了,相当方便。
当你安装一个软件的成功时候,会返回软件的安装路径,找到这个软件包(以git为例)的bin路径,执行
exprot path=/usr/local/git/bin
或者把软件复制到 /usr/bin
cp /usr/local/git /usr/bin
这样就可以全局使用这个命令了,相当方便。
laravel4.0指定某些路由不需要验证,在app/filters.php文件里面
Route::filter('csrf', function()
{
$list=['check_asy_pay_res','check_syn_pay_res/service','check_syn_pay_res/mobile'];//白名单
if (Session::token() !== Input::get('_token')&&!in_array(Request::path(),$list))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
laravel5.0 在appHttpKernel.php 的$middleware里面,去掉这句话
'App\Http\Middleware\VerifyCsrfToken',
或者在中间件app/Http/Middleware/TokenMiddleware.php 里面
public function handle($request, Closure $next)
{
// 使用CSRF
//return parent::handle($request, $next);
// 禁用CSRF
return $next($request);
}
或者
public function handle($request, Closure $next)
{
return parent::addCookieToResponse($request, $next($request));
}
这篇文章用于列举Laravel的调试方法
1.最常用的 dd(),var_dump();
2.debug插件。可以显示sql执行时间,语句。用来做Laravel优化也不错。插件Github地址https://github.com/itsgoingd/clockwork
3.Log::info(),Log::error() 打印的结果在storage文件夹里面。比如淘宝的异步通知,就可以用这个测试,很方便。
4.打印Laravel sql语句方法
$queries = DB::getQueryLog();
$last_query = end($queries);
或者
DB:listen(function($sql)){
Log:info($sql->sql.'--'.$sql->time)
}
1.Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
①没有这个路由或者控制器没有这个方法。
②路由中绑定了对象,根据路径的值去找对象,没有找到这个对象,也是报这个错
2.Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
当提交表单的方法是POST时候,得提交_token值,当然你也可以选择禁用token,或者只让某个路由post提交时,不用验证_token,比如APP与网站API的交互,淘宝的异步通知。
<input type="hidden" name='_token' value="{{csrf_token();}}">
3.You need to use the $fillable property in your Activation class when you use Mass Assignment.
你使用的插入sql语句需要给Model添加可批量插入字段白名单。
protected $fillable = ['id', 'token'];
4.Relationship method must return an object of type IlluminateDatabaseEloquentRelationsRelation
你可能调用了 $model->user这样的方法,找不到user这个对象或者属性报错。