-2

我正在尝试使用 PHPExcel 库创建一个用于加载和读取大型 excel 文件(超过 60,000 行)的应用程序。我正在获取内部服务器。它最多可以工作 600 行。但它不适用于大文件。请帮忙。

或任何其他可用于加载大文件的 php 库。

设置时间限制(36000);

ini_set('max_execution_time', 36000);   

##$top_records is a boolean set to get just the header and the first data row (( For field Mapping))        

if (PHP_SAPI == 'cli')
    die('This example should only be run from a Web Browser');

set_include_path(get_include_path() . PATH_SEPARATOR . SITE_PATH . '/core/extLib/Excel/Classes/');

require_once (SITE_PATH . '/core/extLib/Excel/Classes/PHPExcel.php');

include (SITE_PATH . '/core/extLib/Excel/Classes/PHPExcel/IOFactory.php');
PHPExcel_Cell::setValueBinder1( new PHPExcel_Cell_AdvancedValueBinder() );
$inputFileName = $file;

$inputFileType = PHPExcel_IOFactory::identify($inputFileName);

$objReader = PHPExcel_IOFactory::createReader($inputFileType); 

$objPHPExcel = $objReader->load($inputFileName);

谢谢

4

3 回答 3

1

我有同样的问题。在这条线上工作时会出现问题

$objPHPExcel = $objReader->load($inputFileName);

于 2015-02-19T21:31:28.330 回答
0

不幸的是,PHPExcel 并不意味着处理非常大的文件。更改内存限制或时间限制充其量只是一个临时解决方案,但对于更大的文件,您也会遇到同样的问题。

我可以建议你看看Spout。它非常适合您的用例!

于 2015-01-28T19:23:27.120 回答
0

增加内存限制。(例如:)ini_set('memory_limit', '512'),

或者改用块。关联

于 2016-03-09T10:05:47.557 回答