Solution to garbled php files saved: 1. Set the encoding of the php file itself to match the encoding of the web page; 2. Add "header("Content-Type: text/html;charset= to the PHP page gb2312")"; 3. Set the encoding format of all files to ANSI.
##PHP file garbled code (gb2312 saved, but input utf-8)
Problem : The file has been saved with gb2312, but it still displays garbled characters. After that, joining still didn’t work. Solution: 1. The encoding of the php file itself and the encoding of the web page should match 2. If you want to use gb2312 encoding, then php must output the header: header(" Content-Type: text/html; charset=gb2312"), add a static page, the encoding format of all files is ANSI, you can open it with Notepad, save as, select the encoding as ANSI, overwrite the source file. Note: The difference is between static pages and dynamic pages! For more related knowledge, please visitPHP Chinese website!
The above is the detailed content of What to do if the php file saved is garbled. For more information, please follow other related articles on the PHP Chinese website!