[英]Save XML to the server a file generated by PHP
After some searches on the web and some tests, i can't find the solution and need your help 经过网上搜索和测试后,我找不到解决方案,需要您的帮助
From a php script, i create a XML output : 从一个PHP脚本,我创建一个XML输出:
$xml = new SimpleXMLElement($string);
//some code
echo $xml->asXML();
I Would like to create a file contain the XML and save on my server by using PHP. 我想创建一个包含XML的文件,并使用PHP保存在我的服务器上。
Thanks for your help 谢谢你的帮助
if echo $xml->asXML()
displays the xml then I guess you could use file_put_contents
or other similar function. 如果
echo $xml->asXML()
显示xml,那么我猜您可以使用file_put_contents
或其他类似函数。 ie: 即:
$filepath='/path/to/directory/filename.xml';
file_put_contents( $filepath, $xml->asXML() );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.