天天看点

解决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_setopt($ci, CURLOPT_ENCODING,'gzip');
           

继续阅读