您的位置:首页 > 编程语言 > PHP开发

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

2014-05-15 21:46 585 查看
修改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 initialisations
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (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'));

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: