头像

PHP根据URL下载图片

2018-04-16 17:06:24 浏览()   来源:http://www.phpdaima.com//jsfx-57.html   评论 ( 0 )   

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);
}
用法:
<?php
$url = "http://phpdaima.com/images/logo.png";
$rename = "koonk.png";
imagefromURL($url,$rename);
?>


标签: php
广告不存在
评论0

后面还有条评论,点击查看>>

温馨提示:为规范评论内容,垃圾评论一律封号...