ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 中间件 ## 中间件 ### 中间件方法`handle` ### 中间件必须注入 `$request, Closure $next` ### 中间件必须返回 `return $next($request);` ### 中间件路由 `'middleware' => ['web', 'App\Http\Middleware\Admin']` ### 中间件路由 `->middleware('first', 'second');` ``` <pre class="calibre16">``` namespace App\Http\Middleware; use Illuminate\Http\Middleware\TrustHosts as Middleware; use Closure; class Admin { public function handle($request, Closure $next) { echo '后台'; // Perform action return $next($request); } } ``` ```