This article mainly introduces the solutions for php to output xml headers, and describes the case of php output xml headers in the form of examples. this is a common mistake that many php beginners may make, for more information, see the example in this article. Share it with you for your reference. The specific method is as follows:
Problem description:
Recently, when we made an xml output, we found that the xml document we directly used echo to input will prompt Error: Object # has no method 'load' Error, and then changed header () the output xml header file is fixed. record it below.
Solution:
Because the xml length is too similar to that of the txt file, it causes me to confuse the total txt files.
Now let's take a look at the following code:
The code is as follows:
Echo '<? Xml version = "1.0" encoding = "UTF-8"?>
Http://www.jb51.net/</loc>
2013-01-22T11: 00: 18 + 08: 00
';
Exit;
Such a piece of code does not allow xml verification.
Error message: Error: Object # has no method 'load'
The last half-day query is the same as the files directly placed in 1.xml.
The code is as follows:
The code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
Http://www.jb51.net/</loc>
2013-01-22T11: 00: 18 + 08: 00
Just add a header. I 've been tossing for several hours .....
The code is as follows:
The code is as follows:
<? Php
Header ("Content-type: text/xml ");
Echo '<? Xml version = "1.0" encoding = "UTF-8"?>
Http://www.jb51.net/</loc>
2013-01-22T11: 00: 18 + 08: 00
';
Exit;
I hope this article will help you with php programming.