开发者

Is there anything like ZipArchive but for sending the zip for download without generating the file on disk?

I want to create a zip file in PHP and use the header() function to make it downloadable without having to save the file on the server. But I think the built in ZipArchiv开发者_C百科e can't do this. I found a few that can, but they all add files from existing files, and I need to add it like ZipArchive::addFromString() does.

Does someone knows a class or something with this capabilities?


According to the PHP compression streams documentation ZipArchive registers the zip:// stream wrapper. While I never worked with zip:// streams you could check out if zip.compress works. You can build a test from another example found here.


gzip does it for a file. and for an archive you can use gzip and tar as follows.

tar -cz  thedir 

this is how to do it with zip.

zip - file1.txt file2.txt
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜