我使用以下代码生成zip
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
readfile($zip_name);
Run Code Online (Sandbox Code Playgroud)
这段代码工作正常,但由于不明原因,直到我尝试才行
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
echo file_get_contents($zip_name);
Run Code Online (Sandbox Code Playgroud)
我很好奇在两种情况下都能找到正在发生的事情