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?
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!