我在 PHP 中准备了一个 XML 字符串,我想让用户下载一个 XML 文件中的字符串.
I have prepared an XML string in PHP and I would like to let the user download the string in an XML file.
是否可以在不将 xml 文件物理保存到服务器的情况下为用户提供下载(例如 text.xml)?
Is it possible to offer the user the download (e.g. text.xml) without physically saving the xml file to the server?
<?php
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="text.xml"');
echo $xml_contents;
这篇关于让用户下载一个 XML 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!