laravel中间件学习笔记
路由中间件:
1,创建中间件
php artisan make:middleware CheckLogin2,注册中间件
// Within App\Http\Kernel Class...3,使用中间件
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
Route::group(['middleware' => 'check.login'],function(){控制器中间件
Route::get('tocart','view\cartcontroller@tocart');
Route::get('order_commit/{product_ids}','view\ordercontroller@toOrderCommit');
Route::get('toOrderList','view\ordercontroller@toOrderList');
});
public function __construct()
{
$this->middleware('auth',[
【laravel中间件学习笔记】'except'=>['show','create','store']
]);
}
推荐阅读
- 由浅入深理解AOP
- 继续努力,自主学习家庭Day135(20181015)
- python学习之|python学习之 实现QQ自动发送消息
- 一起来学习C语言的字符串转换函数
- 定制一套英文学习方案
- 漫画初学者如何学习漫画背景的透视画法(这篇教程请收藏好了!)
- 《深度倾听》第5天──「RIA学习力」便签输出第16期
- 如何更好的去学习
- 【韩语学习】(韩语随堂笔记整理)
- 焦点学习田源分享第267天《来访》