Home  >  Article  >  Backend Development  >  What to do if the php file is garbled in the browser

What to do if the php file is garbled in the browser

藏色散人
藏色散人Original
2020-08-10 09:38:512676browse

Solution to the garbled PHP file in the browser: First find and open the PHP source file with garbled characters; then add the statement "header("Content-Type: text/html; charset=utf to the file -8");" and save it.

What to do if the php file is garbled in the browser

Recommended: "PHP Video Tutorial"

PHP program is browsing The problem of Chinese garbled characters

If your PHP source file is encoded in utf-8. If you want the Chinese in your source file to be smooth in the browser, you have to tell the browser that your Chinese is encoded in UTF-8.

Specifically, adding the following sentence

header(“Content-Type: text/html; charset=utf-8”);

took effect in my program. Everyone can try it.

The above is the detailed content of What to do if the php file is garbled in the browser. 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