$doc = new domdocument('1.0');
// we want a nice output
$doc->formatoutput = true;
代码如下 | 复制代码 |
$root = $doc->createelement('book'); $title = $doc->createelement('title');$title = $root->appendchild($title); $text = $doc->createtextnode('this is the title'); echo "retrieving all the document: "; echo "retrieving only the title part: "; |