使用php压缩大文件 [英] Use php to zip large files

查看:423
本文介绍了使用php压缩大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php表单,其中有一堆复选框,所有复选框都包含文件链接.用户单击所需的复选框(文件)后,便会压缩文件并强制进行下载.

I have a php form that has a bunch of checkboxes that all contain links to files. Once a user clicks on which checkboxes (files) they want, it then zips up the files and forces a download.

我下载了一个简单的php zip强制下载文件,但是当其中一个文件很大时,或者如果有人说选择整个列表进行压缩和下载,我的服务器就会出错.

I got a simple php zip force download to work, but when one of the files is huge or if someone lets say selects the whole list to zip up and download, my server errors out.

我知道我可以增加服务器的大小,但是还有其他方法吗?

I understand that I can increase the server size, but are there any other ways?

推荐答案

如果您确实需要它通过PHP,最好的方法是使用流.使用流时,内存需求非常低,并且不会随内容的大小而增长.

If you really need it to go through PHP, best idea is to use streams. With streams, memory requirements are very low and they don't grow with the size of the content.

这篇关于使用php压缩大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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