编程语言PHP下载图片函数
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://www.scutephp.com/images/logo.png";$rename = "logo.png";imagefromURL($url,$rename);?>
其他PHP图片下载函数
php抓取网站图片的程序
文章来源:https://www.php.cn/faq/233291.html
赞 (0)