我尝试读取excel文件并将其转换为数组。但我得到了
following error.
Fatal error:
Allowed memory size of 1677721600 bytes exhausted (tried to allocate 38 bytes)
in /var/www/import_excel/Classes/PHPExcel/Worksheet.php on line 2431
我使用以下代码阅读
set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
include 'PHPExcel/IOFactory.php';
$inputFileName = $target_file;
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
} catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
error_reporting(-1);
ini_set('display_errors',1);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
echo "<pre>";
print_r($allDataInSheet);
die();
我需要将excel数据作为数组获取。但excel文件有130列&amp;超过100行。所以当我试图转换为数组。我收到错误。但是当我尝试用较少的列和行工作时。当我尝试使用130列和50多行时出错。
是否有可用的替换方法来转换数组而不是 $ objPHPExcel-&gt; getActiveSheet() - &gt; toArray(null,true,true,true); 此行。请有人建议或帮我解决这个问题。谢谢