Reputation: 131
How delete php session by the name
example i have session['sec']
and session['page']
i need to delete session['page']
with out delete session['sec']
Upvotes: 3
Views: 9343
Reputation: 2181
// for a single variable
unset($_SESSION['session_var']);
// destroy the Session, not just the data stored!
session_destroy();
// delete the session contents, but keep the session_id and name:
session_unset();
Upvotes: 6
Reputation: 3450
You wouldn't be deleting the session in this case, only the session variable. So just do:
unset($_SESSION['page']);
Upvotes: 2