在已经做了版本格式类型处理下报错的情况下
// 根据文件类型选择
if ($extension == 'xlsx') {
$type = 'Excel2007';
} elseif ($extension == 'xls') {
$type = 'Excel5';
}
// 实例化文件
$excelReaderObj = \PHPExcel_IOFactory::createReader($type);
$objPHPExcelArray[$name] = ($excelReaderObj->load($filepath));
在这里读取xlsx文件都没有任何问题,但是xls文件就会提示
/Classes/PHPExcel/PHPExcel/Shared/OLERead.php,Line:90,Msg:The filename xxx.xls is not recognised as an OLE file
几经搜索无果,把读取的方法修改为
$excelReaderObj = \PHPExcel_IOFactory::createReaderForFile($filepath);
就可以解决了