0

我有一个发送 ZIP 文件的脚本。这是一个 12MB 的大文件,但有时,在极少数情况下,下载会停止在 4MB、5MB、6.5MB(永远不一样)......

<?php

$fullpath = 'foobar.zip';

header('Content-Description: File Transfer');
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename=' . $fullpath);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: '. filesize($fullpath));
ob_clean();
flush();
readfile($fullpath);
exit();

?>

在什么情况下 readfile() 可以在读取所有文件之前停止?还有什么问题吗?

4

0 回答 0