【发布时间】:2011-02-15 09:01:18
【问题描述】:
当我尝试强行提取从服务器下载的 zip 文件夹时,我收到消息“没有要提取的文件”。但是当我直接从服务器下载 zip 文件夹时,我可以正确解压它。这是我用来强制下载的代码。
$file = 'absolute/path/to/the/zip/folder';
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header( "Content-Disposition: attachment; filename=".basename($file));
header( "Content-Description: File Transfer");
@readfile($file);
有人知道为什么会这样吗?任何帮助,将不胜感激。提前致谢
【问题讨论】:
-
抑制读取文件上的错误可能是不明智的。