我要求的解決方案如何使PHP下載文件,而無需重定向並沒有在這個例子中讀取文件源,如:PHP頭文件路徑
if(1 == 1)
{
header("Content-Type: application/xml");
header("Content-Transfer-Encoding: binary");
header("Cache-Control: private",false);
header("Content-Disposition: attachment; filename=example.xml;");
$file = file_get_contents("file.ext");
echo file;
}
我需要不用其他file_get_contents
下載解決方案使下載如mod_rewrite
。
感謝
'PHP下載文件 - 這是不可能 – zerkms 2012-02-20 04:16:49
@zerkms,沒有它不:mod_xsendfile – Petah 2012-02-20 04:24:40
@Petah:這是非常有趣的,謝謝 – zerkms 2012-02-20 06:34:45