将 facebook 图片下载到本地服务器
我正在使用
function save_image($inPath,$outPath){
//Download images from remote server
$in= fopen($inPath, "rb");
$out= fopen($outPath, "wb");
while ($chunk = fread($in,8192))
{
fwrite($out, $chunk, 8192);
}
fclose($in);
fclose($out);
}
此功能,工作正常,但如果我打开图像,它显示文件为空。
我也尝试了 file_get_content() 函数。但仍然遇到同样的问题。
i am using
function save_image($inPath,$outPath){
//Download images from remote server
$in= fopen($inPath, "rb");
$out= fopen($outPath, "wb");
while ($chunk = fread($in,8192))
{
fwrite($out, $chunk, 8192);
}
fclose($in);
fclose($out);
}
This function working perfectly , but if i open the image it show file is empty.
i also tried file_get_content() function .But still having the same problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我总是更喜欢使用curl来做这种事情。
如果您没有安装curl,请查看官方PHP curl 安装说明 ,安装Windows的curl非常简单。
I always prefer to use curl to do this kind of thing.
If you don't have curl installed check the official PHP curl installation instructions, installing curl of Windows is pretty easy.