时间:2021-07-01 10:21:17 帮助过:16人阅读
public function actionExcel(){
$excel_path = dirname(__FILE__) . '/../../files/users.xlsx';
Yii::import('ext.phpexcel.Classes.*');
//关闭yii的自动装载
spl_autoload_unregister(array('YiiBase','autoload'));
include 'PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($excel_path);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
//恢复yii的自动装载
spl_autoload_register(array('YiiBase','autoload'));
}