如何在php保护zip的密码? [英] How to password protect zip in php?
问题描述
我可以使用php中的ziparchive lib创建zip文件。有什么办法可以为我创建的zip文件指定一个密码?有没有其他的自定义库可以做同样的事情?
I am able to create zip file using ziparchive lib in php. Is there any way I can specify a password for the zip files that I create? Is there any other custom library that can do the same?
我的php是运行在安全模式,我的托管服务提供商不允许我改变它。所以我不能做shell_exec()函数。使用任何其他图书馆还有其他方法吗?我检查了 DotNetZip 库,但它表示它仅支持基于 .net 的语言,在windows中,没有提到与php无关的内容。另外我正在使用一个linux服务器。
My php is running in safe mode and my hosting provider does not allow me to change it. So I'm not able to do shell_exec() function. Is there any other way around it by using any other library? I checked the DotNetZip Library, but it says it supports only .net based languages and in windows, nothing related with php is mentioned. Also I'm using a linux server.
应用程序是我有一些动态生成的xml文件,需要压缩,我的客户端将下载它。但是我需要输入一个密码,即使有人拦截它们,他们也无法打开它。
The application is that I have a few xml files that are dynamically generated and need to be zipped and my clients will download it. But I need to put a password so that even though anyone intercepts it, they won't be able to open it.
还是有替代方法? >
Or is there any alternative way?
推荐答案
shell_exec('zip -qjP <password> <archive> <file1> <file2> ... <file_n>');
这篇关于如何在php保护zip的密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!