How do I destroy a session in php

How do I destroy a session in php?

the thing is when the user clicks the logout button the session will end and he will be redirected to the index.php here’s my code

here is the example, you may have a look

session_start();
if (isset($_GET['Logout'])) {
unset($_SESSION['user']);
// or session_destroy();
header('location:index.php');
}

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments