public function SessionManager::destroy in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::destroy()
Destroys the current session and removes session cookies.
Overrides SessionManagerInterface::destroy
1 call to SessionManager::destroy()
- SessionManager::save in core/
lib/ Drupal/ Core/ Session/ SessionManager.php - Force the session to be saved and closed.
File
- core/
lib/ Drupal/ Core/ Session/ SessionManager.php, line 259 - Contains \Drupal\Core\Session\SessionManager.
Class
- SessionManager
- Manages user sessions.
Namespace
Drupal\Core\SessionCode
public function destroy() {
session_destroy();
// Unset the session cookies.
$session_name = $this
->getName();
$cookies = $this->requestStack
->getCurrentRequest()->cookies;
if ($cookies
->has($session_name)) {
$params = session_get_cookie_params();
setcookie($session_name, '', REQUEST_TIME - 3600, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
$cookies
->remove($session_name);
}
}