本文整理匯總了PHP中Cake\Network\Session::renew方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::renew方法的具體用法?PHP Session::renew怎麽用?PHP Session::renew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cake\Network\Session
的用法示例。
在下文中一共展示了Session::renew方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renew
/**
* Used to renew a session id
*
* In your controller: $this->Session->renew();
*
* @return void
*/
public function renew()
{
return Session::renew();
}
示例2: logout
/**
* Log a user out.
*
* Returns the logout action to redirect to. Triggers the `Auth.logout` event
* which the authenticate classes can listen for and perform custom logout logic.
* AuthComponent will remove the session data, so there is no need to do that
* in an authentication object. Logging out will also renew the session id.
* This helps mitigate issues with session replays.
*
* @return string Normalized config `logoutRedirect`
* @link http://book.cakephp.org/3.0/en/controllers/components/authentication.html#logging-users-out
*/
public function logout()
{
$this->_setDefaults();
if (empty($this->_authenticateObjects)) {
$this->constructAuthenticate();
}
$user = (array) $this->user();
$this->dispatchEvent('Auth.logout', [$user]);
$this->session->delete($this->sessionKey);
$this->session->delete('Auth.redirect');
$this->session->renew();
return Router::normalize($this->_config['logoutRedirect']);
}
示例3: renew
/**
* Used to renew a session id
*
* In your controller: $this->Session->renew();
*
* @return void
*/
public function renew()
{
$this->_session->renew();
}
示例4: delete
/**
* Delete user record from session.
*
* The session id is also renewed to help mitigate issues with session replays.
*
* @return void
*/
public function delete()
{
$this->_user = false;
$this->_session->delete($this->_config['key']);
$this->_session->renew();
}