0
(的download.php)PHP強制IE下載文件
......(other HTML code)......
$filepath = '/storage/uploaded_files/'.$thisSysName;
header("Content-Type: application/force-download");
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Disposition: attachment; filename="'.basename($filepath).'"');
readfile($filepath);
......(other HTML code)......
對話做了IE的顯示,但該文件的內容是HTML(的download.php)的內容。
奇怪。
Thanks!現在我只使用GET將其製作成一個PHP文件,並且沒有任何其他HTML不必要的代碼。然後我下載了空的HTML文件,看起來和上面的結果一樣。 –
@ K.W。是否有可能發佈您的PHP文件的第幾行?因爲如果你只是得到了html文件,我很確定在頭文件之前有東西在泄漏。你的網站還活着嗎?如果是的話,我可以檢查漏水情況 – Krimson