G:\workspace\yii\framework\YiiBase.php(155)
143 * @param CApplication $app the application instance. If this is null, the existing 144 * application singleton will be removed. 145 * @throws CException if multiple application instances are registered. 146 */ 147 public static function setApplication($app) 148 { 149 //self::$_app=$app; 150 151 152 if(self::$_app===null || $app===null) 153 self::$_app=$app; 154 else 155 throw new CException(Yii::t('yii','Yii application can only be created once.')); 156 157 }
意思是程序只能被创建一次,执行的语句是G:\workspace\yii\framework\YiiBase.php(155),只要把if判断语句注释掉,直接执行self::$_app=$app;就行了