本文整理汇总了PHP中CHttpSession::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpSession::init方法的具体用法?PHP CHttpSession::init怎么用?PHP CHttpSession::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHttpSession
的用法示例。
在下文中一共展示了CHttpSession::init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the application component.
*
* @return null
*/
public function init()
{
$cookieParams = array('httponly' => true);
if (($defaultCookieDomain = craft()->config->get('defaultCookieDomain')) !== '') {
$cookieParams['domain'] = $defaultCookieDomain;
}
$secureCookies = craft()->config->get('useSecureCookies');
// If it's set to auto and a secure connection or it's set to true, set the secure flag.
if ($secureCookies === 'auto' && craft()->request->isSecureConnection() || $secureCookies === true) {
$cookieParams['secure'] = true;
}
// Set the PHP session cookie to HTTP only.
$this->setCookieParams($cookieParams);
// Check if the config value has actually been set to true/false
$configVal = craft()->config->get('overridePhpSessionLocation');
// If it's set to true, override the PHP save session path.
if (is_bool($configVal) && $configVal === true) {
$this->setSavePath(craft()->path->getSessionPath());
} else {
if ($configVal !== false) {
if (mb_strpos($this->getSavePath(), 'tcp://') === false) {
$this->setSavePath(craft()->path->getSessionPath());
}
}
}
parent::init();
}
示例2: init
/**
* Initializes the application component.
* This method overrides the parent implementation by checking if cache is available.
*/
public function init()
{
$this->_cache = Yii::app()->getComponent($this->cacheID);
if (!$this->_cache instanceof ICache) {
throw new CException(Yii::t('yii', 'CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.', array('{id}' => $this->cacheID)));
}
parent::init();
}
示例3: init
/**
*
*/
public function init()
{
// Check if the config value has actually been set to true/false
$configVal = craft()->config->get('overridePHPSessionLocation');
// If it's set to true, override the PHP save session path.
if (is_bool($configVal) && $configVal === true) {
$this->setSavePath(craft()->path->getSessionPath());
} else {
if ($configVal !== false) {
if (strpos($this->getSavePath(), 'tcp://') === false) {
$this->setSavePath(craft()->path->getSessionPath());
}
}
}
parent::init();
}
示例4: init
/**
* Initializes the application component.
*
* @return null
*/
public function init()
{
$cookieParams = array('httponly' => true);
if (($defaultCookieDomain = craft()->config->get('defaultCookieDomain')) !== '') {
$cookieParams['domain'] = $defaultCookieDomain;
}
// Set the PHP session cookie to HTTP only.
$this->setCookieParams($cookieParams);
// Check if the config value has actually been set to true/false
$configVal = craft()->config->get('overridePHPSessionLocation');
// If it's set to true, override the PHP save session path.
if (is_bool($configVal) && $configVal === true) {
$this->setSavePath(craft()->path->getSessionPath());
} else {
if ($configVal !== false) {
if (mb_strpos($this->getSavePath(), 'tcp://') === false) {
$this->setSavePath(craft()->path->getSessionPath());
}
}
}
parent::init();
}
示例5: getSession
/**
* 获取session对像
*
* @return CHttpSession
*/
public function getSession()
{
if (!isset($this->components['session'])) {
$session = new CHttpSession();
$session->init();
$this->components['session'] = $session;
}
return $this->components['session'];
}
示例6: init
/**
* Initializes the route.
* This method is invoked after the route is created by the route manager.
*/
public function init()
{
$this->setCollection($this->collectionName);
$this->_options = array('fsync' => $this->fsync, 'safe' => $this->safe);
parent::init();
}
示例7: init
/**
* Initializes the application component.
* This method overrides the parent implementation by checking if redis is available.
*/
public function init()
{
$this->getConnection();
parent::init();
}
示例8: init
/**
* Initializes the route.
* This method is invoked after the route is created by the route manager.
*/
public function init()
{
$this->collection = Yii::app()->edmsMongoCollection($this->collectionName, $this->dbName, $this->connectionId);
$this->options = array('fsync' => $this->fsync, 'safe' => $this->safe);
if (!is_null($this->timeout)) {
$this->options['timeout'] = $this->timeout;
}
parent::init();
}
示例9: init
/**
* Initializes the route.
* This method is invoked after the route is created by the route manager.
*/
public function init()
{
$connection = new Mongo($this->connectionString);
$dbName = $this->dbName;
$collectionName = $this->collectionName;
$this->collection = $connection->{$dbName}->{$collectionName};
$this->options = array('fsync' => $this->fsync, 'safe' => $this->safe);
if (!is_null($this->mongoTimeout)) {
$this->options['timeout'] = $this->mongoTimeout;
}
parent::init();
}
示例10: init
public function init()
{
$this->cacheSessionHandler->init();
Yii::log('initialized cache session handler in zurmosession', CLogger::LEVEL_TRACE, 'session');
parent::init();
}