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