• <i id='i1vNN'><tr id='i1vNN'><dt id='i1vNN'><q id='i1vNN'><span id='i1vNN'><b id='i1vNN'><form id='i1vNN'><ins id='i1vNN'></ins><ul id='i1vNN'></ul><sub id='i1vNN'></sub></form><legend id='i1vNN'></legend><bdo id='i1vNN'><pre id='i1vNN'><center id='i1vNN'></center></pre></bdo></b><th id='i1vNN'></th></span></q></dt></tr></i><div id='i1vNN'><tfoot id='i1vNN'></tfoot><dl id='i1vNN'><fieldset id='i1vNN'></fieldset></dl></div>
    <tfoot id='i1vNN'></tfoot>
      <bdo id='i1vNN'></bdo><ul id='i1vNN'></ul>
    <legend id='i1vNN'><style id='i1vNN'><dir id='i1vNN'><q id='i1vNN'></q></dir></style></legend>

  • <small id='i1vNN'></small><noframes id='i1vNN'>

        如何最好地配置 PHP 以处理 UTF-8 网站

        时间:2023-10-03
        • <bdo id='SiuFf'></bdo><ul id='SiuFf'></ul>
              <tbody id='SiuFf'></tbody>

            • <tfoot id='SiuFf'></tfoot>
            • <small id='SiuFf'></small><noframes id='SiuFf'>

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

                • <legend id='SiuFf'><style id='SiuFf'><dir id='SiuFf'><q id='SiuFf'></q></dir></style></legend>
                  本文介绍了如何最好地配置 PHP 以处理 UTF-8 网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  您会推荐哪些扩展以及如何最好地配置 php 以创建一个对所有内容都使用 utf-8 编码的网站.例如...

                  What extensions would you recommend and how should php be best configured to create a website that uses utf-8 encoding for everything. eg...

                  • 页面输出为 utf-8
                  • 表单提交以 utf-8 编码的数据
                  • 字符串数据的内部处理(例如与数据库对话时)也都是 utf-8 格式.

                  目前看来 php 并不能很好地处理多字节字符集.到目前为止,我已经发现 mbstring 看起来像是一个重要的扩展.

                  It seems that php does not really cope well with multibyte character sets at the moment. So far I have worked out that mbstring looks like an important extension.

                  值得麻烦吗..?

                  推荐答案

                  PHP 与 Unicode 内容的假设问题有些夸大其词.自 1998 年以来,我一直在做多语言网站,直到我在某处读到它时才知道可能会出现问题 - 多年后和网站.

                  The supposed issues of PHP with Unicode content have been somewhat overstated. I've been doing multilingual websites since 1998 and never knew there might be an issue until I've read about it somewhere - many years and websites later.

                  这对我来说很好用:

                  Apache 配置(在 httpd.conf 或 .htaccess 中)

                  Apache configuration (in httpd.conf or .htaccess)

                  AddDefaultCharset utf-8
                  

                  PHP(在 php.ini 中)

                  PHP (in php.ini)

                  default_charset = "utf-8"
                  mbstring.internal_encoding=utf-8
                  mbstring.http_output=UTF-8
                  mbstring.encoding_translation=On
                  mbstring.func_overload=6 
                  

                  MySQL

                  CREATE 使用 utf8_* 整理的数据库,让表继承数据库排序规则和使用 "SET NAMES utf8"

                  CREATE your database with an utf8_* collation, let the tables inherit the database collation and start every connection with "SET NAMES utf8"

                  HTML(在 HEAD 元素中)

                  HTML (in HEAD element)

                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
                  

                  这篇关于如何最好地配置 PHP 以处理 UTF-8 网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP DOMDocument 无法处理 utf-8 字符 (☆) 下一篇:如何在 PHP 中迭代 UTF-8 字符串?

                  相关文章

                  最新文章

                  1. <legend id='4Phoj'><style id='4Phoj'><dir id='4Phoj'><q id='4Phoj'></q></dir></style></legend>

                    <tfoot id='4Phoj'></tfoot>
                      <bdo id='4Phoj'></bdo><ul id='4Phoj'></ul>
                    1. <i id='4Phoj'><tr id='4Phoj'><dt id='4Phoj'><q id='4Phoj'><span id='4Phoj'><b id='4Phoj'><form id='4Phoj'><ins id='4Phoj'></ins><ul id='4Phoj'></ul><sub id='4Phoj'></sub></form><legend id='4Phoj'></legend><bdo id='4Phoj'><pre id='4Phoj'><center id='4Phoj'></center></pre></bdo></b><th id='4Phoj'></th></span></q></dt></tr></i><div id='4Phoj'><tfoot id='4Phoj'></tfoot><dl id='4Phoj'><fieldset id='4Phoj'></fieldset></dl></div>
                    2. <small id='4Phoj'></small><noframes id='4Phoj'>