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

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

藏色散人
Release: 2023-03-04 07:34:01
Original
2715 people have browsed it

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”);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template