DOMDocument::saveXML 返回值为空字符串
PHP手册中的的实例:
<br /> $doc = new DOMDocument('1.0');<br /> // we want a nice output<br /> $doc->formatOutput = true;<br /><br /> $root = $doc->createElement('book');<br /> $root = $doc->appendChild($root);<br /><br /> $title = $doc->createElement('title');<br /> $title = $root->appendChild($title);<br /><br /> $text = $doc->cr<strong>(本文来源gaodai#ma#com搞@@代~&码网</strong><pre>搞代gaodaima码
eateTextNode(‘This is the title’);
$text = $title->appendChild($text);
echo “Saving all the document:\n”;
$xmlContent = $doc->saveXML();
var_dump($xmlContent);
打印出的结果是:
Saving all the document: string(72) ” ”
为什么没有打印出完整的XML?请各位前辈指点,Thanks!