How to delete a session by name

How to delete a php session by name For example, I session['sec'] and session['page'] I need to delete session['page'] without deleting session['sec']

+1
source share
3 answers
 // 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(); 
+4
source

This should do it:

 unset($_SESSION['page']); 
+1
source

In this case, you are not deleting the session, but only the session variable. So simple:

 unset($_SESSION['page']); 
+1
source

Source: https://habr.com/ru/post/1238302/


All Articles