我想下载一个.zip文件,但是当我去下载它时,它迫使我下载.php文件。我使用这个遍布互联网的简单代码,所以我不知道为什么我无法下载.zip文件。下载.zip文件问题(下载.php文件)
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: application/zip");
header('Content-length: '.filesize($fullpath));
header("Content-disposition: attachment; filename=".basename($fullpath));
readfile($fullpath);
的zip文件,浏览器是你测试它? – Sjoerd
你确定你不只是下载一个名为.php的压缩文件吗? – JohnP
你不需要'filesize($ fullfile)'吗? – pimvdb