【发布时间】:2012-08-09 03:10:57
【问题描述】:
发现这个: 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 :)
添加了有效的测试代码,但分两步:
<?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');
【问题讨论】: