J'utilise habituellement la méthode prescrite par le manual:
<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Finally, destroy the session.
session_destroy();
?>
La seule chose qui reste est header('Location: index.php');
J'ai suivi toutes vos questions, et vous avez vraiment besoin de lire un tutoriel et/ou la documentation PHP. Vous posez continuellement des questions de base auxquelles il est facile de répondre si vous avez simplement appris PHP. – TravisO