如何将外部镜像复制到本地?
我想检索 http 外部图像并将其复制到我的服务器上的文件夹(例如 /images/example.jpg)
有没有办法使用 symfony 2.0 或基本 PHP 5 函数来做到这一点?
I want to retrive an http external image an copy it to a folder on my server (eg. /images/example.jpg)
Is there a way to do this with symfony 2.0 or with basic PHP 5 functions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
你可以这样做:
file_put_contents('tmp.jpg', file_get_contents('http://static.adzerk.net/Advertisers/3603.jpg'));
但是,要小心,如果是网页,可能会很慢,具体取决于图像页面的速度。
you can do it like this:
file_put_contents('tmp.jpg', file_get_contents('http://static.adzerk.net/Advertisers/3603.jpg'));
But, be careful, if it's a web page, it maybe very slow, depending on the speed of image page.