How to download xml file through in php?

邮差的信 提交于 2019-12-13 07:58:58

问题


I created xml file in php. This file is successfully saved in my server directory.
Now, I want to download this file only through php, not javascript.

How can I save this file?


回答1:


Try file_get_contents() and file_put_contents().

<?PHP

$xml = file_get_contents("http://yoursite.com/yourxml.xml"); // your file is in the string "$xml" now.
file_put_contents("/path/to/file/yourxml.xml", $xml); // now your xml file is saved.

?>


来源:https://stackoverflow.com/questions/5154781/how-to-download-xml-file-through-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!