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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                User Language Class 獲取/設置用戶訪問的頁面語言,如果用戶沒有設置訪問語言,則讀取Accept-Language。根據用戶選擇的語言顯示對應的頁面(英文,簡體中文,繁體中文) **UserLang.class.php** ~~~ <?php /**User Language Class 獲取/設置用戶訪問的頁面語言,如果用戶沒有設置訪問語言,則讀取Accept-Language *Date: 2014-05-26 *Author: fdipzone *Ver: 1.0 * *Func: *public get 獲取用戶訪問語言 *public set 設置用戶訪問語言 *private getAcceptLanguage 獲取HTTP_ACCEPT_LANGUAGE */ class UserLang{ // class start private $name = 'userlang'; // cookie name private $expire = 2592000; // cookie expire 30 days /**初始化 * @param String $name cookie name * @param int $expire cookie expire */ public function __construct($name='', $expire=null){ // 設置cookie name if($name!=''){ $this->name = $name; } // 設置cookie expire if(is_numeric($expire) && $expire>0){ $this->expire = intval($expire); } } /**獲取用戶訪問語言 */ public function get(){ // 判斷用戶是否有設置過語言 if(isset($_COOKIE[$this->name])){ $lang = $_COOKIE[$this->name]; }else{ $lang = $this->getAcceptLanguage(); } return $lang; } /**設置用戶訪問語言 * @param String $lang 用戶訪問語言 */ public function set($lang=''){ $lang = strtolower($lang); // 只能是英文,簡體中文,繁體中文 if(in_array($lang, array('en','sc','tc'))){ setcookie($this->name, $lang, time()+$this->expire); } } /**獲取HTTP_ACCEPT_LANGUAGE */ private function getAcceptLanguage(){ $lang = strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']); if(in_array(substr($lang,0,5), array('zh-tw','zh_hk'))){ $lang = 'tc'; }elseif(in_array(substr($lang,0,5), array('zh-cn','zh-sg'))){ $lang = 'sc'; }else{ $lang = 'en'; } return $lang; } } // class end ?> ~~~ **demo** ~~~ <?php require "UserLang.class.php"; $obj = new UserLang('sitelang', 3600); echo $obj->get().'<br>'; ?> ~~~
                  <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>

                              哎呀哎呀视频在线观看