Skip to content

Kirby 4.5.0

$user->logout()

Logs the user out

$user->logout(Kirby\Session\Session|array|null $session = null): void

Parameters

Name Type Default Description
$session Kirby\Session\Session|array|null null Session options or session object to unset the user in

Parent class

Kirby\Cms\User

Example

<?php

if($user = $kirby->user()) {
  $user->logout();
}

// do something, e.g. redirect to a custom login page
go('login');

?>