Home >Backend Development >PHP Tutorial >Summary of solutions to PHP Chinese encoding problems

Summary of solutions to PHP Chinese encoding problems

WBOY
WBOYOriginal
2016-07-25 08:53:05952browse
  1. header("content-type:text/html; charset=xxx")
  2. AddDefaultCharset xxx
Copy code

It is recommended to add a header("content-type:text/html" to each page ; charset=xxx"), this ensures that it can be displayed correctly on any server and has strong portability. 4), default_charset configuration in PHP.ini: default_charset = "gb2312" in php.ini defines PHP's default language character set. It is generally recommended to comment out this line and let the browser automatically select the language based on the charset in the web page header instead of making a mandatory requirement, so that web services in multiple languages ​​can be provided on the same server. In fact, Chinese coding in PHP development is not as complicated as imagined. Although there are no fixed rules for positioning and solving problems, and various operating environments are also different, the underlying principles are the same. Understanding the knowledge of character sets is the basis for solving character problems. However, with the changes in the Chinese character set, not only PHP programming, but also problems in Chinese information processing will still exist for some time. The above contents are some solution suggestions for friends who have not solved the Chinese coding problem in PHP development. I also hope that friends who are learning PHP can learn more about this knowledge.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn