thinkphp5 PHPExcel 引入与报错解决 PHPExcel_IOFactory' not found

文件目录

thinkphp5  PHPExcel  引入与报错解决
PHPExcel_IOFactory' not found

引入文件

use thinkfacadeApp;
require_once App::getRootPath().'/extend/PHPExcel/PHPExcel.php';

报错:

PHPExcel报错ZipArchive::locateName():

Excel版本问题。
解决方法:判断当前版本。
//   PHPExcel_IOFactory  前面缺少斜杠会报错  找不到类
$objReader = PHPExcel_IOFactory::createReader('Excel2007'); 

if(!$objReader->canRead($file_name)){
);
}
  $objPHPExcel = $objReader->load($file,$encode='utf-8');

亲试,有效。
//   PHPExcel_IOFactory  前面缺少斜杠会报错  找不到类

$objReader = PHPExcel_IOFactory::createReader('Excel5');