2017-10-21 200 views
1

下载不管我使用的功能坏掉的图片文件:PHP保存从URL

copy("http:" . $imglink, "images/" . substr($imglink, 34)); 
//or 
file_put_contents("images/" . substr($imglink, 34), file_get_contents("http:" . $imglink)); 
//or 
file_put_contents("images/" . $productData['imagefile'], fopen($productData['imagelink'], 'r')); 

文件的保存位置断裂,大近4倍。日志中没有错误, 已经确认我可以通过浏览器从远程服务器手动下载健康图像。有任何想法吗?

回答

0

发现问题 - 的图像文件名包含空间炭这应该是 rawurlencode($imglink) -ed之前它被作为参数

传递