<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # JWT插件 composer 安裝 ~~~ composer require firebase/php-jwt ~~~ # 用法 ~~~ use \Firebase\JWT\JWT; $key = "example_key"; $token = array( //"iss" => "http://example.org", // "aud" => "http://example.com", "iat" => 1356999524,//可以是time()時間戳 "nbf" => 1357000000//可以是time()時間戳 ); $jwt = JWT::encode($token, $key); $decoded = JWT::decode($jwt, $key, array('HS256')); print_r($decoded); $decoded_array = (array) $decoded; JWT::$leeway = 60; // $leeway in seconds $decoded = JWT::decode($jwt, $key, array('HS256')); ~~~ ## 補充捕獲異常 ~~~ try { $arr = $jwt::decode($token, $key, array('HS256')); } catch (\Exception $e) { // token驗證失敗 return json(['code' => 0, 'msg' => $e->getMessage()],400)->send(); }catch (ExpiredException $e){ // 過期 return json(['code' => 0, 'msg' => $e->getMessage()],400)->send(); } ~~~ ## 實例 ~~~ class Base extends Common { public function index(Request $request){ $data['username'] = $request->param('username'); //驗證數據 //查詢數據庫 $info = SystemUser::where('id','=','1')->find(); //比對密碼 //返回token $key = 'asdfhjkl'; $payload=[ 'iat'=>time(), 'nbf'=>time(), 'userinfo'=>[ 'uid'=>$info['id'], 'name'=>$info['username'], ] ]; $jwt = JWT::encode($payload,$key); $decoded = JWT::decode($jwt, $key, array('HS256')); return json(['code'=>'1','token'=>$decoded,'msg'=>'成功'])->send(); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看