今天在做一个xml输出时发现我们直接使用echo输入的xml文档会提示Error: Object # has no method ‘load’错误的,后改用了header()输出xml头文件就解决了,下面记录一下.
xml长的和txt文件太相似,所以导致我总和txt混为一谈,代码如下:
echo '<?xml version="1.0" encoding="UTF-8" <sitemap> <loc>http://www.phprm.com/</loc> <lastmod>2013-01-22T11:00:18+08:00</lastmod> </sitemap> '; exit;
这么一段代码,死活输出的xml无法通过xml验证.
Error: Object # has no method ‘load’
最后查了半天都和直接放在1.xml里的文件一样,代码如下:
<?xml version="1.0" encoding="UTF-8" <sitemap> <loc>http://www.phprm.com/</loc> <lastmod>2013-01-22T11:00:18+08:00</lastmod> </sitemap>
加个header就好了,折腾了好几个小时,代码如下:
Statement
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
2 weeks agoByDDD
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor