$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)); }
php SimpleXMLElement 子结点插入SimpleXMLElement
最新推荐文章于 2021-04-02 00:20:42 发布