Phpexcel Ver: 1.7.9c
Referring to the example provided by phpexcel, it is basically no problem to generate an Excel file, mainly because the file inclusion in PHP is a bit complicated,
1) copy the phpexcel directory classes and all subdirectories and files under this directory to the components directory of yii.
2) modify the components/classes/phpexcel/autoloader. php file
public static function Register() { /*if (function_exists('__autoload')) { // Register any existing autoloader function with SPL, so we don't get any clashes spl_autoload_register('__autoload'); } // Register ourselves with SPL return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));*/ $functions = spl_autoload_functions(); foreach ( $functions as $function) spl_autoload_unregister($function); $functions = array_merge(array(array('PHPExcel_Autoloader','Load')),$functions); foreach ( $functions as $function) $x = spl_autoload_register($function); return $x; } // function Register()
/**/Contains the original code, which can be replaced with uncommented code. Otherwise, an error of class undefined will occur.
Reference: http://hi.baidu.com/95857548/item/0130511b07297c532b3e2209