PHP的 DOMDocument
怎么在根节点前插入数据?
比如我要在<root>前插入:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">结果为:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<root>
<item>title</item>
</root>
怎么在根节点前插入数据?
比如我要在<root>前插入:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">结果为:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<root>
<item>title</item>
</root>
这样操作当然没问题。就是不知道PHP的 DOMDocument可不可以。
也许我写的那个不是XML的标准文档。看来我理解错了。看XML去。