PHP 致命错误:未捕获的错误:找不到类“ZipArchive" [英] PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in

查看:42
本文介绍了PHP 致命错误:未捕获的错误:找不到类“ZipArchive"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在努力通过 PHP 安装 zip 扩展.我在尝试使用 ZipArchive 时不断收到错误消息:

I've been struggling with installing zip extension over PHP for a while now. I keep getting an error message while trying to use ZipArchive:

PHP 致命错误:未捕获的错误:在..."中找不到类ZipArchive"

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in '...'

结果:php -m

[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo`
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

sudo pecl list 的结果:

Installed packages, channel pecl.php.net:
=========================================
Package Version State
xdebug  2.5.5   stable
zip     1.15.2  stable

另外,phpinfo 产生了这个结果:

Also, phpinfo produced this result:

看起来 zip 安装正确.

It looks like zip is installed correctly.

还有什么我遗漏的吗?

谢谢.

推荐答案

检查命名空间,尝试 use ZipArchivenew \ZipArchive.否则,请提供有关错误消息的更多信息

check namespace, try use ZipArchive or new \ZipArchive. otherwise, provide more info on the error message

这篇关于PHP 致命错误:未捕获的错误:找不到类“ZipArchive"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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