Home  >  Article  >  Backend Development  >  创设xml数据无法显示

创设xml数据无法显示

WBOY
WBOYOriginal
2016-06-13 10:35:04803browse

创建xml数据无法显示

$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";
echo $doc->saveXML() . "\n";

echo "Saving only the title part:\n";
echo $doc->saveXML($title);

?>

echo 出来只显示
Saving all the document: Saving only the title part: 
xml的内容无法显示出来!

------解决方案--------------------
查看网页源文件

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