Home > Backend Development > PHP Problem > What to do if php outputs garbled xml code

What to do if php outputs garbled xml code

藏色散人
Release: 2023-03-02 12:50:01
Original
3357 people have browsed it

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.

What to do if php outputs garbled xml code

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 visit PHP 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!

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