From c5b308c1c48e87366dc348aac1c2d649527b3485 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Sun, 16 Mar 2025 12:47:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20README.md=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20JwtToken.php=20=E4=B8=AD=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E6=8E=88=E6=9D=83=E4=BF=A1=E6=81=AF=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;