php-laravel中间件使用
中间件使用 1、项目目录下cmd中php artisan make:middleware adminLogin,创建中间件 2、注册中间件(\Http\kernel.php) protected $routeMiddleware = [ 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'adminLogin' => \App\Http\Middleware\AdminLogin::class, ]; 3、在group组中加入中间件过滤路由 Route::group(['namespace'=>'admin','prefix'=>'admin','middleware'=>'adminLogin'],function(){ } 4、打开中间件即可编辑方法(\app\Http\Middleware\adminLogin.php)