本文整理汇总了PHP中yii\web\Session::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::init方法的具体用法?PHP Session::init怎么用?PHP Session::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\Session
的用法示例。
在下文中一共展示了Session::init方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the route.
* This method is invoked after the route is created by the route manager.
*/
public function init()
{
$credentials = new Credentials($this->params['key'], $this->params['secret']);
$this->dynamoDb = DynamoDbClient::factory(['region' => $this->params['region'], 'credentials' => $credentials, 'base_url' => isset($this->params['base_url']) ? $this->params['base_url'] : '']);
$this->tableName = $this->sessionTable;
parent::init();
}
示例2: init
/**
* Initialize the client.
*/
public function init()
{
$this->_client = DynamoDbClient::factory($this->config);
if ($this->keyPrefix === null) {
$this->keyPrefix = substr(md5(Yii::$app->id), 0, 5);
}
parent::init();
}
示例3: init
public function init()
{
if (\Yii::$app->cmsSettings->sessionType == CmsSettings::SESSION_DB) {
$this->dbSession = \Yii::$app->dbSession;
} else {
parent::init();
}
}
示例4: init
/**
* Initializes the application component.
*/
public function init()
{
if (is_string($this->cache)) {
$this->cache = Yii::$app->getComponent($this->cache);
}
if (!$this->cache instanceof Cache) {
throw new InvalidConfigException('CacheSession::cache must refer to the application component ID of a cache object.');
}
parent::init();
}
示例5: init
/**
* Initializes the DbSession component.
* This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
* @throws InvalidConfigException if [[db]] is invalid.
*/
public function init()
{
if (is_string($this->db)) {
$this->db = Yii::$app->getComponent($this->db);
}
if (!$this->db instanceof Connection) {
throw new InvalidConfigException("DbSession::db must be either a DB connection instance or the application component ID of a DB connection.");
}
parent::init();
}
示例6: init
/**
* Initializes the application component.
* This method overrides the parent implementation by checking if cache is available.
*/
public function init()
{
foreach ($this->iniParameters as $k => $v) {
if (!ini_set("session.{$k}", $v)) {
throw new InvalidConfigException("The key session.{$k} could not be set to {$v}.");
}
}
if ($this->servers) {
// Yii::trace( 'old servers:'.print_r( ini_get( 'session.save_path' ), true ), 'ext.CNativeMemcachedSession.init' );
ini_set('session.save_path', $this->servers);
} else {
throw new InvalidConfigException('Forgot the list of servers.');
}
// Yii::trace( 'ses server:'.print_r( $this->servers, true ), 'ext.CNativeMemcachedSession.init' );
parent::init();
}
示例7: init
public function init()
{
parent::init();
if (is_string($this->ssdb)) {
$this->ssdb = \Yii::$app->get($this->ssdb);
} elseif (is_array($this->ssdb)) {
if (!isset($this->ssdb['class'])) {
$this->ssdb['class'] = Connection::className();
}
$this->ssdb = \Yii::createObject($this->ssdb);
}
if (!$this->ssdb instanceof Connection) {
throw new InvalidConfigException("Session::ssdb must be either a Ssdb Connection instance or the application component ID of a ssdb Connection.");
}
if ($this->key_prefix === null) {
$this->key_prefix = substr(md5(Yii::$app->id), 0, 5);
}
}
示例8: init
/**
* Initializes the aerospike Session component.
* This method will initialize the [[aerospike]] property to make sure it refers to a valid aerospike connection.
* @throws InvalidConfigException if [[aerospike]] is invalid.
*/
public function init()
{
if (is_string($this->aerospike)) {
$this->aerospike = Yii::$app->get($this->aerospike);
} elseif (is_array($this->aerospike)) {
if (!isset($this->aerospike['class'])) {
$this->aerospike['class'] = Connection::className();
}
$this->aerospike = Yii::createObject($this->aerospike);
}
if (!$this->aerospike instanceof Connection) {
throw new InvalidConfigException("Session::aerospike must be either a Redis connection instance or the application component ID of a Redis connection.");
}
if ($this->keyPrefix === null) {
$this->keyPrefix = substr(md5(Yii::$app->id), 0, 5);
}
parent::init();
}
示例9: init
/**
* Initializes the application component.
*/
public function init()
{
parent::init();
$this->cache = Instance::ensure($this->cache, Cache::className());
}
示例10: init
/**
* Initializes the DbSession component.
* This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
* @throws InvalidConfigException if [[db]] is invalid.
*/
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
}
示例11: init
public function init()
{
parent::init();
// Yii::$app->cache->useMemcached=true;
register_shutdown_function([$this, 'close']);
}
示例12: init
/**
* Initializes the application component.
* This method overrides the parent implementation by checking if redis is available.
*/
public function init()
{
$this->getConnection();
parent::init();
}
示例13: init
public function init()
{
parent::init();
}