filsh/yii2-oauth2-server

PHPExcel don't work

yuxiuhong opened this issue · 0 comments

`<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;

class ExcelController extends Controller
{
public function actionExport()
{
$dir=dirname(FILE);
$objPHPExcel = new \PHPExcel();
$objSheet=$objPHPExcel->getActiveSheet();
$objSheet->setTitle("demo");
$array=array(
array(),
array('','Name','Score'),
array('','Mary','99'),
array('','Roy','100'),
);
$objSheet->fromArray($array);
$objWriter=PHPExcel_IOFactory::createWriter($objPHPExcel,"Excel5");
$objWriter->save($dir."/demo_1.xls");
}
}`
This is my controller file;

require(__DIR__ . '/../../vendor/PHPExcel/PHPExcel/IOFactory.php');
my index.php file.

error: PHP Fatal Error – yii\base\ErrorException Class 'frontend\controllers\PHPExcel_IOFactory' not found

How to do?someone know?