【发布时间】:2016-04-18 02:23:52
【问题描述】:
我正在使用内容处置,但它不起作用。谁能告诉我为什么?
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename=filename.xml');
【问题讨论】:
我正在使用内容处置,但它不起作用。谁能告诉我为什么?
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename=filename.xml');
【问题讨论】:
这有点模糊。
让我们从基本的开始:你的头函数是在任何输出之前调用的吗?
见http://www.w3schools.com/php/func_http_header.asp
此外,您不能自己显示它。
您只需让浏览器处理您的文件的下载。
它会要求您选择是要“打开”还是“保存”磁盘上的文件。如果您选择“保存”选项,则会打开此窗口。据我所知,您不能强迫用户不要选择“打开方式”。
【讨论】: