我有一个很大的excel文件,我想使用后端上传这些excel文件。上传此文件后,我需要使用sql命令插入到我的数据库中。
我将这些数据放入数组。在那之后我不知道该怎么做。有人可以帮助我吗?
require_once('PHPExcel.php');
$dbHost = "localhost";
$dbDatabase = "ioc_invoice";
$dbPasswrod = "";
$dbUser = "root";
$mysqli = new mysqli($dbHost, $dbUser, $dbPasswrod, $dbDatabase);
$filename = "sample.xlsx";
$type = PHPExcel_IOFactory::identify($filename);
$objReader = PHPExcel_IOFactory::createReader($type);
$objPHPExcel = $objReader->load($filename);
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet)
{
$worksheets[$worksheet->getTitle()] = $worksheet->toArray();
}
print_r($worksheets);
//$worksheets = array();