Home>Article>Backend Development> What to do if php outputs garbled xml code
php xml garbled code is caused by the inconsistency between the PHP program output encoding and the encoding of the XML file. The solutions are: 1. Change gb2312 to "utf-8"; 2. Directly set the PHP file format to ansi The output is normal.
The reason for the error is that the PHP program output encoding and the encoding of the XML file are inconsistent.
Method 1:
Use utf-8 encoding, the modification method is as follows:
1. Change the two gb2312 to utf-8
2. Click the right link on the xml file and select use Open Notepad, save as, change the encoding from ansi, overwrite and save.
Method 2:
Directly set the PHP file format to ansi, and the output will be normal
For more related knowledge, please visitPHP Chinese website!
The above is the detailed content of What to do if php outputs garbled xml code. For more information, please follow other related articles on the PHP Chinese website!