文章目录[隐藏]
PHP saveXML
PHP手册中的的实例:
$doc = new DOMDocument('1.0'); // we want a nice output $doc->formatOutput = true; $root = $doc->createElement('book'); $root = $doc->appendChild($root); $title = $doc->createElement('title'); $title = $root->appendChild($title); $text = $doc->createTextNode('This is the title'); $text = $title->appendChild($text); echo "Saving all the document:\n"; $xmlContent = $doc->saveXML(); var_dump($xmlConte<i>*本5文来源gaodai$ma#com搞$$代**码)网@</i><img>搞代码gaodaima</img>nt);
打印出的结果是:
Saving all the document: string(72) ” ”
为什么没有打印出完整的XML?请各位前辈指点,Thanks!
回复讨论(解决方案)
请在文本方式下查看
Saving all the document:string(72) "<?xml version="1.0"?> <title>This is the title</title>"
明白了,Thanks!