Blogger Information
Blog 9
fans 0
comment 0
visits 7499
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
中间件基础
高杰
Original
642 people have browsed it
  1. 使用astian生成中间件(middleware);语句:php artisan make:middleware Mymiddle

  2. 中间件的位置:app\Http\Middleware 文件夹中

  3. 在如图所示,红色框的位置可以写代码,其他的不需要动

     微信图片_20200610151055.png

  4. 创建完毕middleware后,需要进行注册,位置:app\Http\kernel.php 文件中的 protected $routeMiddleware最下面添加 'mymiddle' => \App\Http\Middleware\Mymiddle::class,

  5. 引用中间件:在路由web.php中,需要使用中间件的路由,后面 Route::get('/myblade', 'Home@myblade')->middleware('mymiddle'); 

Correcting teacher:WJWJ

Correction status:qualified

Teacher's comments:写的不错,认真!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post