使用PHP类ZipArchive创建zip文件而不将文件写入磁盘? [英] Create a zip file using PHP class ZipArchive without writing the file to disk?

查看:290
本文介绍了使用PHP类ZipArchive创建zip文件而不将文件写入磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ZipArchive(或本机PHP类)在内存中创建一个zip文件,然后将文件的内容读回客户端.这可能吗?如果可以,怎么办?

I would like to create a zip file in memory using a ZipArchive (or a native PHP class) and read the content of the file back to the client. Is this possible? If so, how?

我要在此应用程序中压缩的文件最大为15 MB.我认为我们应该在记忆方面保持良好状态.

The files that I want to zip in this application are a maximum of 15 MB total. I think we should be in good shape memory-wise.

推荐答案

看看下面的库,它允许创建zip文件并将其作为流返回:

Take a look at the following library, it allows creating zip files and returning them as a stream: PHPClasses.org.

这篇关于使用PHP类ZipArchive创建zip文件而不将文件写入磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆