<?php
header('Content-type: text/html; charset=utf-8');
$filePath="123.xls";
vendor('PHPExcel.PHPExcel');
$fileType = \PHPExcel_IOFactory::identify($filePath);
$objReader = \PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($filePath);
$currentSheet = $objPHPExcel->getSheet(0);
$allColumn = $currentSheet->getHighestColumn();
$allRow = $currentSheet->getHighestRow();
for ($currentRow = 1; $currentRow <= $allRow; $currentRow++) {
for ($currentColumn = 'A'; $currentColumn <= $allColumn; $currentColumn++) {
$address = $currentColumn . $currentRow;
$arr[$currentRow][$currentColumn] = $currentSheet
->getCell($address)
->getFormattedValue();
}
}
$i = 0;
$str = ",失败信息:<br/>";
var_dump($arr);exit;
?>