$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xyz>AAA</xyz>';//原XML字串 $t_xml = new \DOMDocument(); $t_xml->loadXML($xml); //新的XML字串 $xml_out = $t_xml->saveXML($t_xml->documentElement);//<xyz>AAA</xyz>
參考:
PHP DomDocument output without <?xml version="1.0" encoding="UTF-8"?> - Stack Overflow
沒有留言:
張貼留言