发现这一点: 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);
其中$src
是一些网址http://.../file.gz
例如200 + MB :)
加入的测试代码的作品,但在2个步骤:
<?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');