简体   繁体   English

Google App Engine上的PhpExcel错误:无效或未初始化的Zip对象

[英]PhpExcel on Google App Engine Error: Invalid or uninitialized Zip object

I am trying to parse an XLSX file with PhpExcel on Google App Engine. 我正在尝试使用PhpExcel在Google App Engine上解析XLSX文件。 When I run the script it gives me this error: Invalid or uninitialized Zip object. 当我运行脚本时,它给了我这个错误:无效或未初始化的Zip对象。 I've read other questions but they don't seem to help ( PHPExcel Google App Engine not saving file for Excel2007 ),( Using phpExcel to download xlsx file using Google App Engine ), ( Google App Engine trowing error for PHPExcel ). 我已经阅读了其他问题,但它们似乎并没有帮助( PHPExcel Google App Engine不为Excel2007保存文件 ),( 使用phpExcel使用Google App Engine下载xlsx文件 ),( Google App Engine因PHPExcel出现错误 )。 I have tried to write the file to the temporary folder (sys_get_temp_dir()) but it gives me the same error when i read from there. 我试图将文件写入临时文件夹(sys_get_temp_dir()),但是当我从那里读取时,它给了我同样的错误。

        $inputFileName = $this->Anexos_model->get_path($id_anexo);

    $temp = tempnam(sys_get_temp_dir(), 'TMP_');
    file_put_contents($temp, file_get_contents($inputFileName));

    var_dump($temp);

    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objReader->setReadDataOnly(true);
    $objPHPExcel = $objReader->load($temp);

It gives me this: 它给了我这个:

A PHP Error was encountered 遇到PHP错误

Severity: Warning 严重程度:警告

Message: ZipArchive::getFromName(): Invalid or uninitialized Zip object 消息:ZipArchive :: getFromName():无效或未初始化的Zip对象

Filename: Reader/Excel2007.php 文件名:Reader / Excel2007.php

Have you checked if zlib is active on your php environment ? 您是否检查过zlib是否在您的php环境中处于活动状态? Check also your memory_limit if the XLSX is too big. 如果XLSX太大,也请检查您的memory_limit。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM