PHPExcel_IOFactory :: load致命错误:允许的内存大小为134217728字节耗尽(试图分配32个字节)

时间:2014-02-20 18:31:54

标签: php

我正在使用PHPExcel(在此处找到:https://github.com/PHPOffice/PHPExcel)。如果我尝试读取超过大约2000行,那么它显示内存错误如下。 Excel大约是404KB

  

致命错误:允许的内存大小为134217728字节耗尽(尝试过   在PHPExcelReader / Classes / PHPExcel / Cell.php中分配32个字节)   840行

在下面的PHP代码中,它在$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);失败,因为输出显示"Start" followed by fatal error

PHP代码:

ini_set('memory_limit', '-1');
/** Include path **/
        set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');

/** PHPExcel_IOFactory */
    include 'APIs/PHPExcelReader/Classes/PHPExcel/IOFactory.php';
    $inputFileName = $target;  // File to read
    //echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
    try {
echo "Start";
        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
echo "End";
    } catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }

    $sheetData = $objPHPExcel->getActiveSheet()->rangeToArray('A1:X2000', null, true, true, true)

0 个答案:

没有答案