解壓縮的gzip發現這一點: https://stackoverflow.com/a/11373078/530599 - 偉大的,但與在stream_filter_append和stream_copy_to_stream
怎麼樣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');