修改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'));