我正在尝试通过服务器 B 在服务器 C 上下载一个文件(1GB),该文件具有以下代码:
header("Content-Disposition: attachment; filename=How to Use Git and GitHub Videos.zip");
header("Content-type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
$url = "http://zips.udacity-data.com/ud775/How%20to%20Use%20Git%20and%20GitHub%20Videos.zip";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
curl_exec ($ch);
curl_close($ch);
我期待它会立即开始 dwonlaoding 文件。但相反,我必须等待很长时间,直到我的浏览器窗口会询问在哪里保存它。我认为curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
这意味着它将逐块传输文件,所以我不必等待它会首先读取所有文件。
那么为什么开始下载需要这么长时间呢?我该如何解决?如果这个方法是错误的,请给我一些别的建议