"JWT", //声明类型为jwt "alg" => "HS256" //声明签名算法为SHA256 ]; $jwt = $request->header('token'); $key = env('JWT_SECRET'); try{ JWT::decode($jwt,$key,$alg); } catch (\Exception $e) { return response()->json('token无效:'.$e); } return $next($request); } }