我想要一个扩展来压缩包含其中所有文件和子目录的目录,但是没有创建临时文件,我希望extrnsion名称带有如何使用它的代码?
我在制作临时文件的课时有错误
谢谢,
答案 0 :(得分:0)
你想要http://pablotron.org/software/zipstream-php/。来自文档:
1. Create the zip stream:
$zip = new ZipStream('example.zip');
2. Add one or more files to the archive:
# add first file
$data = file_get_contents('some_file.gif');
$zip->add_file('some_file.gif', $data);
# add second file
$data = file_get_contents('some_file.gif');
$zip->add_file('another_file.png', $data);
3. Finish the zip stream:
$zip->finish();
我会警告你:如果你正在处理非常大的文件,拉链就会破裂。它适用于小文件,但不适用于10兆字节。