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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 代碼 ``` /** * 獲取網站根目錄 * @return string 網站根目錄 */ function cmf_get_root() { $request = Request::instance(); $root = $request->root(); $root = str_replace('/index.php', '', $root); if (defined('APP_NAMESPACE') && APP_NAMESPACE == 'api') { $root = preg_replace('/\/api$/', '', $root); $root = rtrim($root, '/'); } return $root; } /** * 驗證碼檢查,驗證完后銷毀驗證碼 * @param string $value * @param string $id * @return bool */ function cmf_captcha_check($value, $id = "") { $captcha = new \think\captcha\Captcha(); return $captcha->check($value, $id); } /** * CMF密碼比較方法,所有涉及密碼比較的地方都用這個方法 * @param string $password 要比較的密碼 * @param string $passwordInDb 數據庫保存的已經加密過的密碼 * @return boolean 密碼相同,返回true */ function cmf_compare_password($password, $passwordInDb) { if (strpos($passwordInDb, "###") === 0) { return cmf_password($password) == $passwordInDb; } else { return cmf_password_old($password) == $passwordInDb; } } /** * 生成用戶 token * @param $userId * @param $deviceType * @return string 用戶 token */ function cmf_generate_user_token($userId, $deviceType) { $userTokenQuery = Db::name("user_token") ->where('user_id', $userId) ->where('device_type', $deviceType); $findUserToken = $userTokenQuery->find(); $currentTime = time(); $expireTime = $currentTime + 24 * 3600 * 180; $token = md5(uniqid()) . md5(uniqid()); if (empty($findUserToken)) { Db::name("user_token")->insert([ 'token' => $token, 'user_id' => $userId, 'expire_time' => $expireTime, 'create_time' => $currentTime, 'device_type' => $deviceType ]); } else { Db::name("user_token") ->where('user_id', $userId) ->where('device_type', $deviceType) ->update([ 'token' => $token, 'expire_time' => $expireTime, 'create_time' => $currentTime ]); } return $token; } ```
                  <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>

                              哎呀哎呀视频在线观看