一、示例
include './plugin/PHPExcel/PHPExcel.php'; include './plugin/PHPExcel/PHPExcel/IOFactory.php'; include './plugin/PHPExcel/PHPExcel/Reader/Excel5.php'; extract($_REQUEST); $inputFileName = "./product.xlsx"; $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); $sheet = $objPHPExcel->getSheet(0); // 读取第一個工作表 $highestColumm = $sheet->getHighestColumn(); // 取得总列数 $highestRow = $sheet->getHighestRow(); // 取得总行数 for ($i = 1; $i <= $highestRow; $i++) { //获取ID $id = (string)$objPHPExcel->setActiveSheetIndex()->getCell("A" . $i); //获取标题 $title = (string)$objPHPExcel->setActiveSheetIndex()->getCell("B" . $i); } echo "导入数据库完成";