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

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

      <legend id='iDBIE'><style id='iDBIE'><dir id='iDBIE'><q id='iDBIE'></q></dir></style></legend>

    1. <small id='iDBIE'></small><noframes id='iDBIE'>

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

        如何使用 UTF-8 字符串在 PHP 中使用文件系統函數

        How do I use filesystem functions in PHP, using UTF-8 strings?(如何使用 UTF-8 字符串在 PHP 中使用文件系統函數?)
        <tfoot id='yZTG0'></tfoot>

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

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

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

                • <legend id='yZTG0'><style id='yZTG0'><dir id='yZTG0'><q id='yZTG0'></q></dir></style></legend>
                • 本文介紹了如何使用 UTF-8 字符串在 PHP 中使用文件系統函數?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我無法使用 mkdir 創建帶有 UTF-8 字符的文件夾:

                  I can't use mkdir to create folders with UTF-8 characters:

                  <?php
                  $dir_name = "Depósito";
                  mkdir($dir_name);
                  ?>
                  

                  當我在 Windows 資源管理器中瀏覽此文件夾時,文件夾名稱如下所示:

                  when I browse this folder in Windows Explorer, the folder name looks like this:

                  Dep?3sito
                  

                  我該怎么辦?

                  我正在使用 php5

                  推薦答案

                  Just urlencode 需要作為文件名的字符串. urlencode 返回的所有 字符在文件名(NTFS/HFS/UNIX)中都是有效的,然后你可以只需 urldecode 將文件名恢復為 UTF-8(或它們采用的任何編碼).

                  Just urlencode the string desired as a filename. All characters returned from urlencode are valid in filenames (NTFS/HFS/UNIX), then you can just urldecode the filenames back to UTF-8 (or whatever encoding they were in).

                  注意事項(也適用于以下解決方案):

                  Caveats (all apply to the solutions below as well):

                  • 經過 url 編碼后,文件名必須少于 255 個字符(可能是字節).
                  • UTF-8 對許多字符具有多種表示(使用組合字符).如果您不規范化 UTF-8,則可能無法使用 glob 進行搜索或重新打開單個文件.
                  • 您不能依賴 scandir 或類似函數進行 alpha 排序.您必須 urldecode 文件名,然后使用識別 UTF-8(和排序規則)的排序算法.
                  • After url-encoding, the filename must be less that 255 characters (probably bytes).
                  • UTF-8 has multiple representations for many characters (using combining characters). If you don't normalize your UTF-8, you may have trouble searching with glob or reopening an individual file.
                  • You can't rely on scandir or similar functions for alpha-sorting. You must urldecode the filenames then use a sorting algorithm aware of UTF-8 (and collations).

                  以下是不太吸引人的解決方案,但更復雜,但有更多注意事項.

                  The following are less attractive solutions, more complicated and with more caveats.

                  在 Windows 上,PHP 文件系統包裝器期望并返回文件/目錄名稱的 ISO-8859-1 字符串.這給了你兩個選擇:

                  On Windows, the PHP filesystem wrapper expects and returns ISO-8859-1 strings for file/directory names. This gives you two choices:

                  1. 在您的文件名中自由使用 UTF-8,但要了解非 ASCII 字符在 PHP 之外看起來不正確.非 ASCII UTF-8 字符將存儲為多個 單個 ISO-8859-1 字符.例如.ó 在 Windows 資源管理器中將顯示為 ?3.

                  1. Use UTF-8 freely in your filenames, but understand that non-ASCII characters will appear incorrect outside PHP. A non-ASCII UTF-8 char will be stored as multiple single ISO-8859-1 characters. E.g. ó will be appear as ?3 in Windows Explorer.

                  將您的文件/目錄名稱限制為字符可在 ISO-8859-1 中表示.在實踐中,您將在使用之前通過 utf8_decode 傳遞 UTF-8 字符串在文件系統函數中,并傳遞條目 scandir 通過 utf8_encode 以獲取 UTF-8 格式的原始文件名.

                  Limit your file/directory names to characters representable in ISO-8859-1. In practice, you'll pass your UTF-8 strings through utf8_decode before using them in filesystem functions, and pass the entries scandir gives you through utf8_encode to get the original filenames in UTF-8.

                  大量警告!

                  • 如果傳遞給文件系統函數的任何字節匹配無效的WindowsISO-8859-1 中的文件系統字符,你運氣不好.
                  • Windows 可能在非英語語言環境中使用除 ISO-8859-1 以外的編碼.我猜它通常是 ISO-8859-# 之一,但這意味著您需要使用 mb_convert_encoding 而不是 utf8_decode.
                  • If any byte passed to a filesystem function matches an invalid Windows filesystem character in ISO-8859-1, you're out of luck.
                  • Windows may use an encoding other than ISO-8859-1 in non-English locales. I'd guess it will usually be one of ISO-8859-#, but this means you'll need to use mb_convert_encoding instead of utf8_decode.

                  這個噩夢就是為什么你應該音譯來創建文件名.

                  This nightmare is why you should probably just transliterate to create filenames.

                  這篇關于如何使用 UTF-8 字符串在 PHP 中使用文件系統函數?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 找不到驅動程序)

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

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

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

                            主站蜘蛛池模板: 男女激情网站免费 | 毛片黄片免费看 | www.色综合| 日韩精品成人一区二区三区视频 | 欧美午夜影院 | 亚洲欧美在线一区 | 黄色毛片在线观看 | 欧美成人免费在线 | 久久久激情视频 | 免费午夜剧场 | 亚洲va国产日韩欧美精品色婷婷 | 黄网站免费观看 | 黄色成人在线网站 | 欧美福利 | 国产精品视频久久久 | 91精品国产高清一区二区三区 | 超碰天天 | www.久久.com | 99久久婷婷国产综合精品首页 | 久久国内精品 | 国产欧美在线视频 | 国产精品免费在线 | 毛片av免费看 | 男人天堂99 | 精品综合 | 性生生活大片免费看视频 | 可以在线看的黄色网址 | 一区二区不卡高清 | 欧美精品一区二区三区四区 | 精品中文字幕在线观看 | 偷拍第一页 | 91在线电影 | 精品一区二区三区四区 | 亚洲性视频 | 一本一道久久a久久精品蜜桃 | 天天摸天天看 | 国产精品v| 97伦理电影 | 黑人精品欧美一区二区蜜桃 | 在线日韩中文字幕 | 中文字幕 国产精品 |