本文整理汇总了PHP中Yii::_app方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::_app方法的具体用法?PHP Yii::_app怎么用?PHP Yii::_app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::_app方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setApplication
/**
* Stores the application instance in the class static member.
* This method helps implement a singleton pattern for CApplication.
* Repeated invocation of this method or the CApplication constructor
* will cause the throw of an exception.
* To retrieve the application instance, use {@link app()}.
* @param CApplication $app the application instance. If this is null, the existing
* application singleton will be removed.
* @throws CException if multiple application instances are registered.
*/
public static function setApplication($app)
{
if (self::$_app === null || $app === null) {
self::$_app = $app;
} else {
throw new CException(Yii::t('yii', 'Yii application can only be created once.'));
}
}