本文整理汇总了PHP中Yii::container方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::container方法的具体用法?PHP Yii::container怎么用?PHP Yii::container使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::container方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
/**
* Destroy Yii app singleton, DI container, session and cookies
*/
protected function tearDown()
{
$_COOKIE = [];
\Yii::$app->session->destroy();
\Yii::$app = null;
\Yii::$container = new Container();
$this->urlManager = [];
parent::tearDown();
}
示例2: pie
}
echo '</pre>';
}
/**
* Prints given object within pre tag and exit code execution.
* @param mixed $object
* @see p
*/
public static function pie($object)
{
self::p($object);
exit;
}
/**
* Wrapper for standard [[BaseYii::t()]] translation function.
* @param string $message Message to be translated.
* @param array $params The parameters that will be used to replace the corresponding placeholders in the
* message.
* @param string $category The message category.
* @return string The translated message.
* @see t
*/
public static function tr($message, $params = [], $category = 'app')
{
return self::t($category, $message, $params);
}
}
spl_autoload_register(['Yii', 'autoload'], true, true);
// Yii::$classMap = require( __DIR__ . '/classes.php' );
Yii::$container = new yii\di\Container();
示例3: destroyApplication
/**
* Destroys application in Yii::$app by setting it to null.
*/
protected function destroyApplication()
{
Yii::$app = null;
Yii::$container = new Container();
}