天天看點

解決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');
           

繼續閱讀