【问题描述】:
我正在尝试使用 PHP excel 库导入 excel。它适用于小数据。但它不适用于超过 30000 行的 excel。我尝试增加内存限制和执行时间。也需要很长时间。这是我的代码
ini_set('upload_max_filesize', '64M');
ini_set('memory_limit', '4096M');
ini_set('max_execution_time', 0);
ini_set('max_input_time', -1);
$fileName = $_FILES["production"]["tmp_name"];
$objPHPExcel = PHPExcel_IOFactory::load($fileName);
$phpspreadsheet = $objPHPExcel->getSheet(0);
$total_data = $phpspreadsheet->getHighestRow();
//echo $chunkSize;
// exit;
$highest_column = $phpspreadsheet->getHighestColumn();
for ($row = 2 ; $row rangeToArray ('A' . $row . ':' . $highest_column . $row, NULL, TRUE, FALSE);
$line =htmlentities($productionDataAll[0][0]);
$workedorder =htmlentities($productionDataAll[0][1]);
$modelnumber =htmlentities($productionDataAll[0][2]);
$revision =htmlentities($productionDataAll[0][3]);
if(!empty($productionDataAll[0][4])){
$serialnumber = htmlentities($productionDataAll[0][4]);
}else{
$serialnumber='';
}
$lpn = htmlentities($productionDataAll[0][5]);
$shift = htmlentities($productionDataAll[0][6]);
$datecreated = htmlentities($productionDataAll[0][7]);
$datecompleted = htmlentities($productionDataAll[0][8]);
$repairflag = htmlentities($productionDataAll[0][9]);
$date=date("Y-m-d", strtotime( '-1 days' ) );
$skeydate = date("Ymd", strtotime( '-1 days' ) );
$skey = $skeydate.$line;
$importproduction = importproduction(
$mysql_connectionLinkLocal,
$line,
$workedorder,
$modelnumber,
$revision,
$serialnumber,
$lpn,
$shift,
$repairflag,
$date,
$skey,
$datecreated,
$datecompleted);
}
我尝试使用块过滤器。但它不起作用。如何使用上面的代码添加块过滤器?
【讨论】:
© 版权声明
本站下载的源码均来自公开网络收集转发二次开发而来,
若侵犯了您的合法权益,请来信通知我们1413333033@qq.com,
我们会及时删除,给您带来的不便,我们深表歉意。
下载用户仅供学习交流,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担,访问及下载者下载默认同意本站声明的免责申明,请合理使用切勿商用。
THE END
暂无评论内容