1
下面的代碼顯示的是二進制數據,而不是顯示PDF文件的下載對話框。二進制輸出代替PDF文件的下載對話框
我在做什麼錯?
header("Pragma: public");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=\"".basename($filepath)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath));
readfile($filepath);
exit
;
already tried application/pdf but no luck !
這應該通常工作。您是否嘗試過使用其他瀏覽器? – blue
是的嘗試FF和Chrome – user1421214
我不確定它是否會幫助,但嘗試刪除文件名末尾的「**; **」。 – blue