Reference

$user->logout()

Logs the user out

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

Parameters

Name Type Default Description
$session \Session|array null

Session options or session object to unset the user in

Return type

void

Example

<?php

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

go('login');

?>

Source code

kirby/src/Cms/User.php#L403