如何通过PHP下载xml文件?

Lay*_*ric -1 php xml fbjs

我在php中创建了xml文件.此文件已成功保存在我的服务器目录中.
现在,我想只通过PHP下载此文件,而不是javascript.

我该如何保存这个文件?

Edu*_*rd7 7

尝试file_get_contents()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.

?>
Run Code Online (Sandbox Code Playgroud)