开发者

Saving an Image

I have a picture url like this http://www.address.com/image.jpg

I want do dyn开发者_如何学编程amically save this image on my server

How can i achieve this using php

Thanks


You can get it using file_get_contents() and saving it using file_put_contents(). Something like:

$image = file_get_contents('http://www.address.com/image.jpg');
file_put_contents('image.jpg', $image);

You also might want look into cURL to fetch the image; it should perform better than file_get_contents() (unless you compile curl with --with-curlwrappers)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜