久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='LehQj'><style id='LehQj'><dir id='LehQj'><q id='LehQj'></q></dir></style></legend>
  • <tfoot id='LehQj'></tfoot>

        <bdo id='LehQj'></bdo><ul id='LehQj'></ul>

      1. <i id='LehQj'><tr id='LehQj'><dt id='LehQj'><q id='LehQj'><span id='LehQj'><b id='LehQj'><form id='LehQj'><ins id='LehQj'></ins><ul id='LehQj'></ul><sub id='LehQj'></sub></form><legend id='LehQj'></legend><bdo id='LehQj'><pre id='LehQj'><center id='LehQj'></center></pre></bdo></b><th id='LehQj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LehQj'><tfoot id='LehQj'></tfoot><dl id='LehQj'><fieldset id='LehQj'></fieldset></dl></div>

        <small id='LehQj'></small><noframes id='LehQj'>

        Zend_Cache:加載緩存數(shù)據(jù)后,字符編碼好像亂了

        Zend_Cache: After loading cached data, character encoding seems messed up(Zend_Cache:加載緩存數(shù)據(jù)后,字符編碼好像亂了)

          • <i id='VAkm0'><tr id='VAkm0'><dt id='VAkm0'><q id='VAkm0'><span id='VAkm0'><b id='VAkm0'><form id='VAkm0'><ins id='VAkm0'></ins><ul id='VAkm0'></ul><sub id='VAkm0'></sub></form><legend id='VAkm0'></legend><bdo id='VAkm0'><pre id='VAkm0'><center id='VAkm0'></center></pre></bdo></b><th id='VAkm0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VAkm0'><tfoot id='VAkm0'></tfoot><dl id='VAkm0'><fieldset id='VAkm0'></fieldset></dl></div>
              <bdo id='VAkm0'></bdo><ul id='VAkm0'></ul>
                  <tbody id='VAkm0'></tbody>

                  <legend id='VAkm0'><style id='VAkm0'><dir id='VAkm0'><q id='VAkm0'></q></dir></style></legend>
                1. <small id='VAkm0'></small><noframes id='VAkm0'>

                  <tfoot id='VAkm0'></tfoot>
                  本文介紹了Zend_Cache:加載緩存數(shù)據(jù)后,字符編碼好像亂了的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  第一;在我的開發(fā)服務器(本地主機;OSX 上的默認 XAMPP)上一切正常,但當我將完全相同的代碼(和數(shù)據(jù))部署到臨時服務器(在 Redhat 上托管 Apache2)時,它會中斷.

                  First; On my development server (localhost; default XAMPP on OSX) everything works fine, though when I deploy the exact same code (and data) to the staging server (managed Apache2 on Redhat) it breaks.

                  我正在使用 Zend_Cache 使用文件后端和自動序列化緩存一些數(shù)據(jù).原始數(shù)據(jù)中使用的特殊字符顯示正常,但當它們從緩存中加載時,它們都是亂碼.

                  I'm caching some data using Zend_Cache using the File backend and auto-serialization. Special characters used in the original data display fine, though when they are loaded from cache they're all garbled up.

                  有人知道嗎?

                  附注.我正在尋找一種方法來了解臨時服務器上可能出現(xiàn)的錯誤",而不是只是一種解決方法.什么可能會搞砸?

                  PS. Instead of just a workaround, I'm looking for a way to understand what might go "wrong" on the staging server. What could possibly mess this up?

                  更新我緩存的數(shù)據(jù)是 UTF-8 編碼的.

                  UPDATE The data I'm caching is UTF-8 encoded.

                  更新在查看原始緩存文件(序列化數(shù)組的)時,我看到了一個很大的不同;當暫存服務器上緩存的(相同)數(shù)據(jù)確實顯示換行符時,我的本地主機上緩存的數(shù)據(jù)不顯示換行符.

                  UPDATE When looking at the raw cache files (of a serialized array) there i See one big difference; The data cached on my localhost shows no newlines when the (identical) data cached on the staging server does show newlines.

                  更新本地服務器運行 PHP 5.3,臨時服務器運行 PHP 5.2.10

                  UPDATE Local server runs PHP 5.3, staging server runs PHP 5.2.10

                  更新在 Zend FW 1.10.8 上運行

                  UPDATE Running on Zend FW 1.10.8

                  推薦答案

                  我和你的情況幾乎一模一樣,

                  I have almost identical state like you ,

                  開發(fā)機器windows + php 5.3

                  development machine is windows + php 5.3

                  開發(fā)機為Linux + php 5.2.14

                  development machine is Linux + php 5.2.14

                  ZF 版本是 1.10

                  ZF version is 1.10

                  我唯一的區(qū)別是:我曾經(jīng)在引導類中添加 mb_internal_encoding("UTF-8");

                  the only difference i had is : i used to add mb_internal_encoding("UTF-8"); in the bootstrap class

                  僅供參考,我曾經(jīng)從數(shù)據(jù)庫中緩存所有編碼的 UTF8 文本(阿拉伯語)當我打開文件時,我看到了預期的阿拉伯語文本.

                  FYI , I used to cache text (arabic language ) from database all encoded UTF8 when i open the file i see the arabic text as expected .

                  更新:1- 這是我完整的 initCache 函數(shù),只是為了清楚起見

                  UPDATE : 1- here is my complete initCache function just to make it clear

                  public function _initCache() {
                          mb_internal_encoding("UTF-8");
                          $frontendOptions = array(
                              'automatic_serialization' => TRUE,
                              'lifetime' => 86400
                          );
                          $backendOptions = array(
                              'cache_dir' => APPLICATION_PATH . "/configs/cache/",
                                  ///'cache_dir' => sys_get_temp_dir(),
                          );
                          $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
                          Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
                          Zend_Registry::set("cache", $cache);
                      }
                  

                  說明:1-任何早于 PHP 6 的 php 版本都沒有對 UTF-8 的本機支持,https://stackoverflow.com/questions/716703/what-is-coming-in-php-6

                  Explanation : 1-Any php version earlier than PHP 6 doesn't have native support for UTF-8 , https://stackoverflow.com/questions/716703/what-is-coming-in-php-6

                  2-使 php 5.3 或 5.2 使用 ICONV 處理 UTF8或 MB_STRING

                  2-making php 5.3 or 5.2 deal with UTF8 by using ICONV or MB_STRING

                  只需使用 var_dump(mb_internal_encoding());

                  你可以在內(nèi)部使用 ISO-8859-1 告訴 php,

                  you can tell that php using ISO-8859-1 internally ,

                  你可以通過var_dump(mb_internal_encoding("UTF-8"));

                  它會輸出真(它成功覆蓋內(nèi)部編碼)

                  it would output true (it success to override the internal encoding )

                  老實說,我不知道是否有更好的解決方案或如何不好是嗎??,

                  to be honest i don't know if there is better solution or how bad it is ?? ,

                  如果你有更好的我會很樂意采用它:)

                  if you had any better i would be happy to adopt it :)

                  更新 2如果您不想使用該功能,打開這個文件 "Zend/Cache/Backend/File.php" 并轉(zhuǎn)到第 976 行改變這個:

                  UPDATE 2 in case you don't want to use that function , open this file "Zend/Cache/Backend/File.php" and go to the line 976 change this :

                  protected function _filePutContents($file, $string)
                  {
                  
                      $result = false;
                      $f = @fopen($file, 'ab+');
                      if ($f) {
                          if ($this->_options['file_locking']) @flock($f, LOCK_EX);
                          fseek($f, 0);
                          ftruncate($f, 0);
                          $tmp = @fwrite($f, $string);
                          if (!($tmp === FALSE)) {
                              $result = true;
                          }
                          @fclose($f);
                      }
                      @chmod($file, $this->_options['cache_file_umask']);
                      return $result;
                  }
                  

                  成為這樣:

                  protected function _filePutContents($file, $string)
                  {
                      $string = mb_convert_encoding($string   , "UTF-8" , "ISO-8859-1"); // i didn't test it , use it at your own risk and i'd rather stick with the first solution 
                      $result = false;
                      $f = @fopen($file, 'ab+');
                      if ($f) {
                          if ($this->_options['file_locking']) @flock($f, LOCK_EX);
                          fseek($f, 0);
                          ftruncate($f, 0);
                          $tmp = @fwrite($f, $string);
                          if (!($tmp === FALSE)) {
                              $result = true;
                          }
                          @fclose($f);
                      }
                      @chmod($file, $this->_options['cache_file_umask']);
                      return $result;
                  }
                  

                  我沒有手動測試,但它應該按預期工作

                  i didn't test manually but it should work as expected

                  很高興它有所幫助!

                  這篇關于Zend_Cache:加載緩存數(shù)據(jù)后,字符編碼好像亂了的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                      <bdo id='K8w1k'></bdo><ul id='K8w1k'></ul>
                      <tfoot id='K8w1k'></tfoot>
                    • <legend id='K8w1k'><style id='K8w1k'><dir id='K8w1k'><q id='K8w1k'></q></dir></style></legend>

                      • <i id='K8w1k'><tr id='K8w1k'><dt id='K8w1k'><q id='K8w1k'><span id='K8w1k'><b id='K8w1k'><form id='K8w1k'><ins id='K8w1k'></ins><ul id='K8w1k'></ul><sub id='K8w1k'></sub></form><legend id='K8w1k'></legend><bdo id='K8w1k'><pre id='K8w1k'><center id='K8w1k'></center></pre></bdo></b><th id='K8w1k'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='K8w1k'><tfoot id='K8w1k'></tfoot><dl id='K8w1k'><fieldset id='K8w1k'></fieldset></dl></div>

                        <small id='K8w1k'></small><noframes id='K8w1k'>

                            <tbody id='K8w1k'></tbody>

                            主站蜘蛛池模板: 国产美女在线看 | 青青草在线播放 | 成人欧美一区二区三区黑人孕妇 | 免费的av网站 | 伊人焦久影院 | 91免费小视频| 中文字幕在线网 | 天天天插| 国产精品99| 日本不卡一区 | 成人不卡 | 乳色吐息在线观看 | 欧美一级一 | 国产精品成人一区二区三区 | 欧美日韩一区二区在线 | 欧美无乱码久久久免费午夜一区 | 新疆少妇videos高潮 | 国产成人久久精品一区二区三区 | 亚洲国产精品久久久久秋霞不卡 | 奇米影视在线 | 色视频在线观看 | 99精品热视频 | 粉嫩高清一区二区三区 | 欧美激情国产日韩精品一区18 | a国产一区二区免费入口 | 久久久久久免费毛片精品 | 亚洲九色| 国产精品视频一二三区 | 免费看黄视频网站 | 国产乱人伦 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 | 日韩一级免费电影 | 中文字幕日本一区二区 | 一级日批片 | 日韩一区二区三区在线 | 91欧美| 欧美精品在欧美一区二区少妇 | 国产在线中文字幕 | 一本色道精品久久一区二区三区 | 日韩成人免费av | 亚洲精品美女视频 |