php SimpleXMLElement 子结点插入SimpleXMLElement

来源:互联网 发布:windows运行命令 编辑:程序博客网 时间:2024/06/07 05:54
$to_xml = simplexml_load_file("father.xml");$from_xml = simplexml_load_file("son.xml");sxml_append($to_xml , $from_xml );var_dump($to_xml);function sxml_append(SimpleXMLElement $to, SimpleXMLElement $from){        $to_dom = dom_import_simplexml($to);        $from_dom = dom_import_simplexml($from);        $to_dom->appendChild($to_dom->ownerDocument->importNode($from_dom, true));}
0 0