简体   繁体   English

PHP 7.2.7:尝试调用类“ZipArchive”的名为“setEncryptionName”的未定义方法

[英]PHP 7.2.7: Attempted to call an undefined method named “setEncryptionName” of class “ZipArchive”

I am attempting to create an encrypted, password protected ZIP file using PHP 7.2.7. 我试图使用PHP 7.2.7创建一个加密的,受密码保护的ZIP文件。 However, I am getting the following error message: 但是,我收到以下错误消息:

Attempted to call an undefined method named "setEncryptionName" of class "ZipArchive".

http://php.net/manual/en/ziparchive.setencryptionname.php http://php.net/manual/en/ziparchive.setencryptionname.php

If I remove $zip->setEncryptionName() then everything works 100%, except that the ZIP file is then not password protected. 如果我删除$zip->setEncryptionName()那么一切都可以100%工作,但ZIP文件不受密码保护。

I have done a Google & Forum search and cannot find anybody that has experienced a similar problem, probably because the PHP version and functionality is still so new. 我已经完成了谷歌和论坛搜索,找不到任何遇到类似问题的人,可能是因为PHP版本和功能仍然很新。

For the ZipArchive::setEncryptionName method to work You will need PHP >= 7.2 With the ZIP extension. 使ZipArchive::setEncryptionName方法工作您将需要PHP> = 7.2使用ZIP扩展名。

Note the the ZIP extension needs to be compiled with libzip-dev >= 1.2.0 请注意,ZIP扩展需要使用libzip-dev > = 1.2.0进行编译

A common issue in many pre-compiled packages is that the compiler did not upgrade libzip-dev before compiling the php-zip extension. 许多预编译包中的一个常见问题是编译器在编译php-zip扩展之前没有升级libzip-dev。 Which is probably your case. 这可能是你的情况。

Be aware that your ZIPs will not be encrypted and that the setPassword() function is only used to extract zips if ZipArchive::setEncryptionName is not available. 请注意,如果ZipArchive::setEncryptionName不可用,您的ZIP将不会被加密,并且setPassword()函数仅用于提取拉链。

Here is the changelog: http://pecl.php.net/package-info.php?package=zip&version=1.14.0 这是更改日志: http//pecl.php.net/package-info.php? package = zip&version = 1.14.0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 试图调用一个未定义的名为“查询”的类的方法 - Attempted to call an undefined method named “query” of class 尝试调用类的名为“ getEntityManager”的未定义方法 - Attempted to call an undefined method named “getEntityManager” of class 尝试调用类的名为“ renderView”的未定义方法 - Attempted to call an undefined method named “renderView” of class php 7.2 ZipArchive 类没有 setEncryptionName 函数 - php 7.2 ZipArchive class not having setEncryptionName function 尝试调用类“ Zend \\ Http \\ Client”中名为“ request”的未定义方法 - Attempted to call an undefined method named “request” of class “Zend\Http\Client” 尝试调用类“ DOMElement”的未定义方法“ filter” - Attempted to call an undefined method named “filter” of class “DOMElement” 尝试调用类“ Knp \\ Menu \\ MenuItem”的名为“ setCurrentUri”的未定义方法 - Attempted to call an undefined method named “setCurrentUri” of class “Knp\Menu\MenuItem” 试图调用类“ MailController”的未定义方法“ get” - Attempted to call an undefined method named “get” of class “MailController” 尝试调用类“ App \\ Twig \\ AppExtension”中名为“ getDoctrine”的未定义方法 - Attempted to call an undefined method named “getDoctrine” of class “App\Twig\AppExtension” 尝试调用类“ Swift_Mailer”的名为“ getContext”的未定义方法 - Attempted to call an undefined method named “getContext” of class “Swift_Mailer”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM