Home >Backend Development >PHP Problem >How to solve the garbled problem of php5.6
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.
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!