使用PHPExcel时找不到类"ZipArchive"错误 [英] Class 'ZipArchive' not found error while using PHPExcel

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

问题描述

当我在新服务器上使用PHPExcel时, 我遇到错误找不到类'ZipArchive'的错误",它似乎被我的托管服务提供商阻止了.

When I use PHPExcel on a new server, I faced the error "Class 'ZipArchive' not found" and it seems to be blocked by my hosting service provider.

没有Zip支持的服务器上不能使用PHPExcel吗? 此服务器上安装了PHP 5.2.8,但我不能将基本的PHP源代码用于PHPExcel.

Can't I use PHPExcel on the server without Zip support? PHP 5.2.8 is installed on this server but I can't use a basic PHP source code for PHPExcel.

任何帮助将不胜感激, 谢谢.

Any help will be appreciated, thanks.

推荐答案

某些电子表格文件格式(例如OfficeOpenXML被Excel 2007及更高版本用作默认格式)需要ZipArchive.在最新的PHP版本中,ZipArchive始终可用,但是在PHP 5.3之前,它需要作为PHP扩展手动安装在某些系统上.

Certain spreadsheet file formats, such as OfficeOpenXML used as the default format by Excel 2007 and above, require ZipArchive. In most recent versions of PHP, ZipArchive is always available, but prior to PHP 5.3 it needed to be manually installed on some systems as a PHP extension.

如果您尚未为PHP安装/启用ZipArchive,并且无法自己启用,则可以使用

If you don't have ZipArchive installed/enabled for your PHP, and can't enable it yourself, then you can use

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

PCLZip包含在PHPExcel发行版中,以替代PHP的内置ZipArchive类,尽管它的速度要慢得多.启用PCLZip,即使没有ZipArchive,也可以使用基于zip的电子表格格式.

PCLZip is included in the PHPExcel distribution as an alternative to PHP's built-in ZipArchive class, though it is quite a bit slower. Enabling PCLZip allows you to work with zip-based spreadsheet formats even without ZipArchive.

但是,当我们第一次捆绑PCLZip(最初在PHPExcel 1.7.6中)时,这只是编写基于zip的格式时的一种选择,而不是在阅读它们时的一种选择.我们在PHPExcel 1.8.0中进行了更改,因此启用PCLZip现在允许您读取和编写基于zip的格式.

However, when we first bundled PCLZip (originally in PHPExcel 1.7.6), it was only an option when writing zip-based formats, not when reading them. We changed that in PHPExcel 1.8.0, so enabling PCLZip now allows you to read zip-based formats as well as writing them.

PHPEXcel Reader文档详细介绍了不同的电子表格格式,并说明了哪些基于zip. PHPEXcel Reader文档

The PHPEXcel Reader documentation details the different spreadsheet formats, and explains which ones are zip-based. PHPEXcel Reader documentation

这篇关于使用PHPExcel时找不到类"ZipArchive"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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