使用PHPExcel时未启用ZipArchive库 [英] ZipArchive Library Is Not Enabled When Using PHPExcel

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

问题描述

我使用CodeIgniter和PHPExcel读取和写入excel文件。

I am using CodeIgniter and PHPExcel to read and write to excel files.

在localhost中一切正常,但当我上传我的PHP CodeIgniter应用程序到服务器 pagodabox 当我尝试从excel文件读取数据时,我收到以下消息。

Everything worked fine in localhost, but when I uploaded my PHP CodeIgniter application to the server in pagodabox I got the below message when I tried to read data from excel files.

Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library is not enabled' in /var/www/application/libraries/PHPExcel/Reader/Excel2007.php


推荐答案

PHPExcel提供PCLZip作为ZipArchive 。您可以通过调用

For writing, PHPExcel does provide PCLZip as an alternative to ZipArchive. You can configure it to use this by calling

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

但是如果你想读取任何压缩的电子表格文件格式(例如xlsx,ods)确实需要启用PHP的zip存档扩展

But if you want to read any of the zipped spreadsheet file formats (e.g. xlsx, ods) then you do need PHP's zip archive extension enabled

EDIT

.0,当读取压缩格式以及写入时,PCLZIP选项现在可用

With effect from version 1.8.0, the PCLZIP option is now available when reading zipped formats as well as for writing them

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

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