一、示例

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 "导入数据库完成";

 

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-08-15
  • 2021-06-21
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2021-07-24
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案