您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

laravel控制器使用中间件

2024/3/11 20:36:15发布15次查看
官方文档写的比较简单,只用如下就行了,但你使用过程中是会报错的,因为还没建立对应关系
public function __construct(){ $this->middleware('wechatapi');}
打开app/http/kernel.php
protected $routemiddleware = [ 'auth' => \app\http\middleware\authenticate::class, 'auth.basic' => \illuminate\auth\middleware\authenticatewithbasicauth::class, 'guest' => \app\http\middleware\redirectifauthenticated::class, 'throttle' => \illuminate\routing\middleware\throttlerequests::class, 'wechatapi'=>\app\http\middleware\wechatapi::class,];
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product