时间:2021-07-01 10:21:17 帮助过:15人阅读
哦!可能是gzip编码的问题
方法1:
$data = file_get_contents("compress.zlib://".$url);
方法2:curl
function curl_get($url, $gzip=false){ $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); if($gzip) curl_setopt($curl, CURLOPT_ENCODING, "gzip"); // 关键在这里 $content = curl_exec($curl); curl_close($curl); return $content; }
方法3:gzip函数解压缩自己去查手冊