找不到PHPExcel ZipArchive [英] PHPExcel ZipArchive not found

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

问题描述

我刚刚下载了PHPExcel软件包,并尝试导入Excel电子表格,但是得到的只是一个错误ZipArchive not found.我在Windows上工作,但服务器在Linux上.我检查了php.ini来查看是否禁用了php_zip,但实际上还没有.

I've just downloaded PHPExcel package and I tried to import an Excel spreadsheet, but all I get is an error ZipArchive not found. I work on Windows, but server is on Linux. I checked php.ini to see if php_zip is disabled, but it wasn't even there.

我尝试使用PECL安装它:$ pecl install zip

I tried installing it with PECL: $ pecl install zip

No releases availble for package "pecl.php.net/zip" Cannot initialize 'channel://pecl.php.net/zip', invalid or missing package file Package "channel://pecl.php.net/zip" is not valid install failed

No releases availble for package "pecl.php.net/zip" Cannot initialize 'channel://pecl.php.net/zip', invalid or missing package file Package "channel://pecl.php.net/zip" is not valid install failed

还有pear install zip-1.10.2.tgz,但收到的消息几乎相同.

And also pear install zip-1.10.2.tgz but recieved pretty much the same message.

我没有服务器的root权限,也许是这样吗?无论如何,你能帮我这个忙吗?

I don't have root permission to the server, maybe that's the case? Anyways, could you help me with this?

推荐答案

某些电子表格文件格式(例如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 as a PHP extension.

如@briosheje所说,如果您没有为PHP安装/启用ZipArchive,则可以使用

As @briosheje says If you don't have ZipArchive installed/enabled for your PHP, 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.

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

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

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