下面是执行相同操作的示例代码 -
$file = file_get_contents('http://example.com/');echo $file;
下面演示了一种替代方案 -
readfile('http://example.com/');header('content-type: text/xml'); //the correct mime type has to be set before displaying the output.
也可以使用asxml方法。以下是示例代码 -
echo $xml->asxml();or$xml->asxml('filename.xml'); //providing a name for the xml file.
以上就是如何在php中输出xml文件的详细内容。
