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($xmlcontent);
打印出的结果是:
saving all the document: string(72)
为什么没有打印出完整的xml?请各位前辈指点,thanks!
回复讨论(解决方案) 请在文本方式下查看 saving all the document:string(72) this is the title
明白了,thanks!