diff --git a/README.md b/README.md index 9d2598d..a5e6bd5 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,15 @@ NGINX配置 JwtToken.php 需要修改成如下 搜索 private static function getTokenFromHeaders(): string 定位路径 ``` - private static function getTokenFromHeaders(): string + private static function getTokenFromHeaders(): string { // $authorization = !empty(request()->header('authorization'))?request()->header('authorization'):request()->header('token'); $token1 = request()->header('Authorization'); $token2 =request()->header('Token'); $authorization_tmp = !empty($token1) ? $token1 : $token2; + if(empty($authorization_tmp)){ + throw new JwtTokenException('请求未携带authorization信息'); + } // $authorization='Bearer '.$authorization_tmp; if (strpos($authorization_tmp,"Bearer ") === false) { $authorization= 'Bearer '.$authorization_tmp;