首页 >后端开发 >php教程 >DOMDocument:saveXML 返回值替空字符串

DOMDocument:saveXML 返回值替空字符串

WBOY
WBOY原创
2016-06-13 11:39:24905浏览

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->createTextNode('This is the title');<br />	$text = $title->appendChild($text);<br /><br />		<br />	echo "Saving all the document:\n";<br />	<br />	$xmlContent = $doc->saveXML();<br />	<br />	var_dump($xmlContent);<br />


打印出的结果是:
Saving all the document: string(72) " " 

为什么没有打印出完整的XML?请各位前辈指点,Thanks!

PHP saveXML
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn