Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 SPLFile 类创建一个 CSV 文件:
$z=new SplFileObject('/tmp/test.csv.gz','w'); $arr=[['a','b','c'],[1,2,3],[2,4,8],[3,6,9]]; foreach($arr as $f) $z->fputcsv($f);
有没有办法 gz 压缩我的输出?
谢谢
通用汽车
您可以使用包装器。在这种情况下,您可以使用zlib。
$z=new SplFileObject('compress.zlib:///tmp/test.csv.gz','w'); $arr=[['a','b','c'],[1,2,3],[2,4,8],[3,6,9]]; foreach($arr as $f) $z->fputcsv($f);