Yii引入PHPExcel修改其自动加载方法

来源:互联网 发布:网络与新媒体工资待遇 编辑:程序博客网 时间:2024/05/18 00:07
修改PHPEXCEL目录下的Autoload.php这个文件,在每次使用PHPExcel的类时关闭Yii的自动加载类,否则的话会因为加载规则的不一致(如yii一般要求类的名字必须是xxController,方法要是actionXXX,而PHPExcel是xx_xxx_xxxx)而起冲突报错。  spl_autoload_unregister(array('YiiBase','autoload'));PHPExcel_Autoloader::Register();//As we always try to run the autoloader before anything else, we can use it to do a few//simple checks and initialisationsPHPExcel_Shared_ZipStreamWrapper::register();// check mbstring.func_overloadif (ini_get('mbstring.func_overload') & 2) {    throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');}PHPExcel_Shared_String::buildCharacterSets();spl_autoload_register(array('YiiBase','autoload'));

0 0
原创粉丝点击