function imagefromURL($image,$rename)
{
	$ch = curl_init($image);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
	$rawdata=curl_exec ($ch);
	curl_close ($ch);
	$fp = fopen("$rename",'w');
	fwrite($fp, $rawdata); 
	fclose($fp);
}

语法:

$url = "http://www.dmaku.com/images/logo.png";
$rename = "dmaku.png";
imagefromURL($url,$rename);


 标签 php URL 下载图片
相关评论(0)
发 布 (Ctrl+Enter)
还没有评论,快来抢沙发吧!