【发布时间】:2013-11-20 19:59:29
【问题描述】:
我使用以下代码生成 zip
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
readfile($zip_name);
这段代码运行良好,但由于未知原因在我尝试之前无法运行
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
echo file_get_contents($zip_name);
我很想知道这两种情况发生了什么
【问题讨论】:
-
你的意思是
file_get_contents对吧? -
“不工作”是什么意思?您是否尝试将错误报告设置为适当的值并阅读任何错误/警告消息?
-
是的,我这样做了,它显示的是一个空白页,只有一个 \n
-
@Shankar 是的 file_get_contents 第一次工作等等
标签: php function filesystems readfile