我准备用CURLOPT_BUFFERSIZE参数下载大文件,下面的代码存在什么问题呢?
<?php
$url="http://gensho.acc.umu.se/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso";
$ch=curl_init();
$a_opt=array(
CURLOPT_URL => $url,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_BINARYTRANSFER => 1,
CURLOPT_BUFFERSIZE => 102400
);
curl_setopt_array($ch,$a_opt);
$str=curl_exec($ch);
$f=fopen('/tmp/debian.iso','w');
fwrite($f,$str)
?>
<?php
$url="http://gensho.acc.umu.se/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso";
$ch=curl_init();
$a_opt=array(
CURLOPT_URL => $url,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_BINARYTRANSFER => 1,
CURLOPT_BUFFERSIZE => 102400
);
curl_setopt_array($ch,$a_opt);
$str=curl_exec($ch);
$f=fopen('/tmp/debian.iso','w');
fwrite($f,$str)
?>