发现这个: https ://stackoverflow.com/a/11373078/530599 - 很好,但是
怎么样stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_*
寻找另一种解压缩数据的方法。
$fp = fopen($src, 'rb');
$to = fopen($output, 'wb');
// some filtering here?
stream_copy_to_stream($fp, $to);
fclose($fp);
fclose($to);
例如 200+ Mb$src
的一些网址在哪里:)http://.../file.gz
添加了有效的测试代码,但分两步:
<?php
$src = 'http://is.auto.ru/catalog/catalog.xml.gz';
$fp = fopen($src, 'rb');
$to = fopen(dirname(__FILE__) . '/output.txt.gz', 'wb');
stream_copy_to_stream($fp, $to);
fclose($fp);
fclose($to);
copy('compress.zlib://' . dirname(__FILE__) . '/output.txt.gz', dirname(__FILE__) . '/output.txt');