使用file_get_contents下载图片

 

 

<?php

/*

当你在搭建网站时,从远程服务器下载某张图片并且将其保存在自己的服务器上,这一操作会经常用到。代码如下:

*/

$image = file_get_contents('http://www.url.com/image.jpg');

file_put_contents('/images/image.jpg', $image); //Where to save the image

 

文章来源:刘俊涛的博客

地址:http://www.cnblogs.com/lovebing

欢迎关注,有问题一起学习欢迎留言、评论。

原文地址:https://www.cnblogs.com/lovebing/p/8086978.html