有人能建议我们如何在php 7.2中创建密码保护的zip吗?
$zip = new \ZipArchive();
//now working in php 7.2"
$zip->setPassword($password);
//also this is not creating protected zip
$zip->setEncryptionName($filename, ZipArchive::EM_AES_256, $password);
我正在尝试使用PHP 7.2.7创建一个加密的、受密码保护的ZIP文件。但是,我收到以下错误消息:
Attempted to call an undefined method named "setEncryptionName" of class "ZipArchive".
如果我删除$zip->setEncryptionName(),那么所有东西都可以100%工作,除了ZIP文件没有密码保护。
我已经做了谷歌和论坛搜索,找不到任何人有类似的问题,可能是因为PHP的版本和功能仍然是如此新。
我正在用PHP创建一个给定文件的zip文件。下面是函数
function create_zip($file, $file_name)
{
$zip = new ZipArchive();
$zip_name = $file_name. ".zip"; // Zip name
$zip->open($zip_name, ZipArchive::CREATE);
if (file_exists($file)) {
$zip->addFromString(basename($file), file_get_co
我想要创建受密码保护的ZIP:
// Set the compression level
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
// Set the encryption flag to true
// If this is set to false, then the rest of encryption properties are ignored
parameters.setEncryptFiles(true);
// Set the encryption method to Stan
在使用python模块zipfile时,由于某些原因,我不知道不能为创建的存档设置密码。
当试图解压缩后的空压缩存档,我可以这样做,而不提示密码。
这是我的密码,怎么了?
import zipfile
with zipfile.ZipFile("1.zip","w") as zip:
zip.setpassword("1234")
我想创建受密码保护的ZIP:
// Set the compression level
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
// Set the encryption flag to true
// If this is set to false, then the rest of encryption properties are ignored
parameters.setEncryptFiles(true);
// Set the en
我正在使用创建一个启用密码的zip文件,下面是这个文件的代码:
using (ZipFile zip = new ZipFile())
{
string[] Files = Directory.GetFiles(cryptPath, "*.*");
foreach (string f in Files)
{
zip.AddFile(f);
}
zip.Password = "mypassord";
zip.Save(
我正在尝试使用Rebex库创建一个受密码保护的zip文件。
下面是我使用的代码
using (ZipArchive zip = new ZipArchive(ZipFilePath, ArchiveOpenMode.Create))
{
// Set the Password first
zip.Password = strUserPIN;
// Change the default Encryption algorithm
zip.EncryptionAlgorithm = EncryptionAlgorithm.Aes256;
// Add the fil
正在尝试使用Ionic zip库在UWP中创建zip文件。我手动将Ionic.Zip.dll添加到项目中。这样做之后,下面的代码给出了一个异常。
using (ZipFile zip = new ZipFile()) -------------> Exception on this line
{
zip.Password = "password";
zip.AddFile(file.Name);
zip.Save();
我在c#中对压缩文件使用DotNetZip。我可以用下面的代码创建带有密码的zip文件: using (ZipFile zip = new ZipFile()
{
zip.Password = "password";
zip.AddDirectory(path);
zip.Save(outputPath);
} 我使用此代码压缩文件我的目录或文件。但是我想在我的zip文件中设置密码。 因此,我使用以下代码: using (ZipFile zip = new ZipFile("MyFile.zip")
{
zip.Password