要压缩的文件最少为40M
我的代码
$data = implode( " ", file( "timer.php "));
$gzdata = gzencode($data, 9);
$fp = fopen( "file.php.gz ", "w ");
fwrite($fp, $gzdata);
fclose($fp)
------解决方案--------------------
http://php.net/manual/zh/refs.compression.php
------解决方案--------------------
zlib支持字节流,不过php接口太简化了,你可以用:
http://www.php.net/manual/zh/function.gzopen.php
打开普通文件,fopen+fread慢慢读,然后gzopen+gzwrite慢慢写。