[英]Class 'ZipArchive' not found in Laravel
I installed the php7-2-zip package in Linux, but I have:我在 Linux 中安装了 php7-2-zip 包,但我有:
Fatal error: Class 'Zip Archive' not found
致命错误:找不到“Zip Archive”类
when I use this line:当我使用这一行时:
$archive = new ZipArchive();
This error means either ZipArchive
is not installed on your system or you are not using it correctly.此错误意味着您的系统上未安装
ZipArchive
或您未正确使用它。
if ZipArchive
is installed already then enable it by adding below line in your php.ini file如果已经安装了
ZipArchive
则通过在 php.ini 文件中添加以下行来启用它
extension=zip.so
then restart your server & use it like然后重新启动您的服务器并使用它
$archive = new \ZipArchive();
or it is not installed then installed it using below command:或者它没有安装然后使用以下命令安装它:
sudo apt-get install php-zip
try this尝试这个
sudo apt-get install php7.2-zip
sudo phpenmod zip
sudo service apache2 restart
你需要使用反斜杠\\
- $archive = new \\ZipArchive();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.