相关疑难解决方法(0)

PHP readfile与file_get_contents

我使用以下代码生成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)

我很好奇在两种情况下都能找到正在发生的事情

php filesystems function readfile

31
推荐指数
1
解决办法
3万
查看次数

标签 统计

filesystems ×1

function ×1

php ×1

readfile ×1