通过图片URL下载图片到本地
$imgUrl = "http://offlintab.firefoxchina.cn/static/img/search/baidu_web.png";
ob_clean();
ob_start();
readfile($imgUrl);
$img = ob_get_contents();
fwrite($fp,$img);
ob_clean();
ob_start();
readfile($imgUrl);
$img = ob_get_contents();
ob_end_clean();
$imgName = "test.jpg"; //自定义图片名称
$savePath = "./test"; //自定图片存放路径
$fp = fopen($savePath.$imgName,"w");fwrite($fp,$img);
fclose($fp);
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: Linux stat函数讲解:
- 下一篇: Python学习之路(1)--python运行三种方式