<?php
ini_set('memory_limit',-1); //没有内存限制
require_once dirname(__FILE__) . '/PHPExcel-1.8/Classes/PHPExcel.php';
$excel_file = dirname(__FILE__) . '/yzc.xlsx';
$input_file_type = PHPExcel_IOFactory::identify($excel_file);
$obj_reader = PHPExcel_IOFactory::createReader($input_file_type);
$obj_php_excel = $obj_reader->load($excel_file);
$sheet = $obj_php_excel->getSheet(0);
$highest_row = $sheet->getHighestRow();
$highest_column = $sheet->getHighestColumn();
var_dump($highest_row, $highest_column);
// 获取一行的数据
$data = [];
for ($row = 2; $row <= $highest_row; $row++){
// Read a row of data into an array
$row_data = $sheet->rangeToArray('A' . $row . ':' . $highest_column . $row, NULL, TRUE, FALSE);
//
}
网友评论