-2
我需要在將header()重定向到推送文件進行下載之前顯示文本。因此,例如在header()文件下載之前顯示文本
echo "text";
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Content-Transfer-Encoding: binary');
while (!feof($handle)) {
echo fgets($handle, $chunksize);
flush();
}
fclose($handle);
這樣可行嗎?
也許它是重複的,但另一個線程不會給我一個答案 - 我不能在這種情況下使用META刷新 – 2013-04-28 21:15:58
沒有[其他重複問題](https://www.google.co。英國/搜索?q =站點%3Astackoverflow.com + PHP +顯示器+網頁+和+下載+文件&A q = F&OQ =站點%3Astackoverflow.com + PHP +顯示器+網頁+和+下載+文件和AQS = chrome.0.57j58.10495j0及的SourceID =鉻&即= UTF-8) – Quentin 2013-04-28 21:17:04