Reputation: 25
I am doing a e-commerce website. I would like to clarify something.
Let say, If I want to do a session_destroy to the session item that I've in my cart after I click on logout, can I check with you, is it something like this?
<?php
$logout = "login.php";
if(isset($logout))
{
session_destroy();
}
?>
Upvotes: 0
Views: 156
Reputation: 26451
session_destroy()
destroys all of the data associated with the current session. If you fine with it, you can use or rather use unset
to clear any specific session with specifying it's key like: unset($_SESSION['cart_items']);
Upvotes: 1
Reputation: 12306
In your example isset($logout)
always return TRUE and you destroy session every execution of script. Is it that you want?
Upvotes: 0