解决PHP curl或file_get_contents下载图片损坏或无法打开的问题

原因是图片被gizp了

解决办法一:

 $url = 'https://fuss10.elemecdn.com/c/6c/69a7740b4ab864ac0639eb583d68fjpeg.jpeg';
 $img = file_get_contents("compress.zlib://".$url);
 $data = file_put_contents('E:/img/aaaaaaaaaaaa.jpeg',$img);

解决办法二:

在curl里加上这段代码

curl_setopt($ci, CURLOPT_ENCODING,'gzip');
原文地址:https://www.cnblogs.com/caibaotimes/p/15407879.html