现在我在上传包含240000行的 xlsx 工作表时出错。
问题是代码无法正确读取文件。这是我从我的 php 代码的结果中得到的。
Warning: simplexml_load_string(): Memory allocation failed : building attribute
in C:\xampp\htdocs\excelamysql\Classes\PHPExcel\Reader\Excel2007.php on line 625
Warning: simplexml_load_string(): Memory allocation failed in C:\xampp\htdocs\ex
celamysql\Classes\PHPExcel\Reader\Excel2007.php on line 625
Warning: simplexml_load_string(): Entity: line 2: parser error : Memory allocati
on failed : xmlSAX2AttributeNs in C:\xampp\htdocs\excelamysql\Classes\PHPExcel\R
eader\Excel2007.php on line 625
Warning: simplexml_load_string(): >48161</v></c><c r="B27695" s="10" t="s"><v>49
</v></c><c r="C27695" s="11" t="s" in C:\xampp\htdocs\excelamysql\Classes\PHPExc
el\Reader\Excel2007.php on line 625
Warning: simplexml_load_string():
^ in C:\xampp\htdocs\excelamysql\Classes\PHPExc
el\Reader\Excel2007.php on line 625
Warning: simplexml_load_string(): Entity: line 2: parser error : Extra content a
t the end of the document in C:\xampp\htdocs\excelamysql\Classes\PHPExcel\Reader
\Excel2007.php on line 625
Warning: simplexml_load_string(): >48161</v></c><c r="B27695" s="10" t="s"><v>49
</v></c><c r="C27695" s="11" t="s" in C:\xampp\htdocs\excelamysql\Classes\PHPExc
el\Reader\Excel2007.php on line 625
Warning: simplexml_load_string():
^ in C:\xampp\htdocs\excelamysql\Classes\PHPExc
el\Reader\Excel2007.php on line 625
这是一段php代码:
$objReader->setLoadSheetsOnly($sheetname);
$objPHPExcel = $objReader->load('C:\xampp\htdocs\excelamysql\Maestra.xlsx');
$worksheet = $objPHPExcel->setActiveSheetIndex(0);
foreach($worksheet->getRowIterator() as $row)
{
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(TRUE);
foreach($cellIterator as $cell)
{
$val = $cell->getValue();
$dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
}
}
for ($row = 2; $row <= $highestRow; ++ $row)
{
$val=array();
$cell = $worksheet->getCellByColumnAndRow(12, $row);
$val[] = $cell->getValue();
$sql="insert ignore into Estado (Id_est,nom_est )values('".'auto'."','" . $val[0] . "')";
$link= mysql("pago_coberturas", $sql);
$sql2="ALTER TABLE Estado AUTO_INCREMENT = 1";
$link2= mysql("pago_coberturas",$sql2);