Home  >  Article  >  Backend Development  >  How to solve the garbled problem of php5.6

How to solve the garbled problem of php5.6

藏色散人
藏色散人Original
2020-10-05 10:13:352779browse

Solution to php5.6 garbled code: first find and open the "php.ini" file; then find "default_charset="UTF-8"" and modify it to "default_charset = """; finally Just restart.

How to solve the garbled problem of php5.6

Recommended: "PHP Video Tutorial"

PHP 5.6 Chinese Garbled Code

5.6 sets the default character set to UTF-8, causing the value of charset in the Content-Type attribute in HTTPHeader to be charset=utf-8;

Because the value in HTTPHeader The encoding setting priority is higher than the encoding setting in the mata tag in the page, so no matter what encoding the page is, the browser always recognizes it as UTF-8, resulting in garbled characters.

In /etc/php5/cli/php.ini and and /etc/php5/apache2/php.ini, find default_charset="UTF-8 ", changed to default_charset = "", Chinese can be displayed normally after restarting.

The above is the detailed content of How to solve the garbled problem of php5.6. For more information, please follow other related articles on the PHP Chinese website!

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