Home  >  Article  >  Backend Development  >  What should I do if the php page has garbled characters?

What should I do if the php page has garbled characters?

藏色散人
藏色散人Original
2019-09-16 14:09:463671browse

What should I do if the php page has garbled characters?

What should I do if the php page has garbled characters?

Solution to garbled php page:

Write at the top of the PHP file:

header('Content-type:text/html;charset=utf-8');

to display Chinese.

or

Open the php.ini file, find; default_charset = "iso-8859-1", change it to: default_charset = "UTF-8" and remove the preceding semicolon (Remove the comments), change the character set to UTF-8, restart the apache service, refresh the page, and the Chinese display will be normal.

Related recommendations: "PHP Tutorial"

The above is the detailed content of What should I do if the php page has garbled characters?. 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