<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ?第一步:composer安裝? ? ``` composer require firebase/php-jwt ``` ``` 第一步: composerrequire firebase/php-jwt 第二步 <?php namespace app\\controller; use Firebase\\JWT\\ExpiredException; use Firebase\\JWT\\JWT as JWTUtil; use think\\Exception; class JWT { /\*\* \* 根據json web token設置的規則生成token \* @return \\think\\response\\Json \*/ static public function createjwt() { $key = md5('dd'); //jwt的簽發密鑰,驗證token的時候需要用到 $time = time(); //簽發時間 $expire = $time + 14400; //過期時間 $token = array( "user\_id" => 1, "iss" => "http://www.najingquan.com/",//簽發組織 "aud" => "zz", //簽發作者 "iat" => $time, "nbf" => $time, "exp" => $expire ); return JWTUtil::encode($token,$key); } /\*\* \* 驗證token \* @return \\think\\response\\Json \*/ static public function verifyjwt() { $jwt= input("jwt"); $key = md5('dd'); //jwt的簽發密鑰,驗證token的時候需要用到 try { $jwtAuth = json\_encode(JWTUtil::decode($jwt, $key, array("HS256"))); $authInfo = json\_decode($jwtAuth, true); if (!$authInfo\['user\_id'\]) { return json(\[ 'msg'=>'失敗', 'code'=>'600', 'data'=>'', \]); } return json(\[ 'msg'=>'OK', 'code'=>'200', 'data'=>'', \]); } catch (ExpiredException $e) { throw new Exception('token過期'); } catch (\\Exception $e) { throw new Exception($e->getMessage()); } } public static function getRequestToken() { if (empty($\_SERVER\['HTTP\_AUTHORIZATION'\])) { return false; } $header = $\_SERVER\['HTTP\_AUTHORIZATION'\]; $method = 'bearer'; //去除token中可能存在的bearer標識 return trim(str\_ireplace($method,'',$header)); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看