现在很多网页都是GZIP压缩的,如果用PHP取过来发现是一堆乱码,可以用GZIP函数类解压,但有时候PHP编译没编译GZIP
可用下面函数代替:
$flags = ( ( $data, 3, 1 ) ); $headerlen = 10; $extralen = 0; $filenamelen = 0; ($flags & 4) { $extralen = ( 'v', ( $data, 10, 2 ) ); $extralen = $extralen [1]; $headerlen += 2 + $extralen; } ($flags & 8) // Filename $headerlen = ( $data, ( 0 ), $headerlen ) + 1; ($flags & 16) // Comment $headerlen = ( $data, ( 0 ), $headerlen ) + 1; ($flags & 2) // CRC at end of file $headerlen += 2; $unpacked = @ ( ( $data, $headerlen ) ); ($unpacked === FALSE) $unpacked = $data; $unpacked;
}}