简体   繁体   中英

How Delete session by the name

如何通过名称示例删除php会话我有session['sec']session['page']我需要删除session['page']而没有delete session['sec']

// 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();

应该这样做:

unset($_SESSION['page']);

You wouldn't be deleting the session in this case, only the session variable. So just do:

unset($_SESSION['page']);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM