卷毛之后清空撞锤

时间:2012-07-14 16:28:18

标签: php curl

我正在使用curl下载大文件,但我不认为缓冲区是空的,因为ram里程不断增加,直到达到100%,这是我使用的代码。

如果我关闭并打开卷曲会有帮助??

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);

while($start_range <= $end_range) {
if(($start_range + 999999) > $end_range) $range = $start_range.'-';
else $range = $start_range.'-'.($start_range + 999999);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $url);

curl_setopt($ch,CURLOPT_HTTPHEADER,array("ETag: $rddash"));
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_RANGE,$range);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
if ($tmp = curl_exec($ch))  $start_range +=1000000;
echo $tmp;
flush();
} 
curl_close($ch);

1 个答案:

答案 0 :(得分:2)

curl_close(), takes a Curl resource as its only parameter,   
closes the Curl session, then frees up the associated memory.