2012-05-22 114 views

回答

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

这应做到:

unset($_SESSION['page']); 
+0

是这会删除会话 – choppermio

+0

这将删除一个会话变量,并留下其余不变。 –

+0

感谢您的帮助 – choppermio

1

你止跌在这种情况下,不会删除会话,只会话变量。所以只是做:

unset($_SESSION['page']); 
+0

当然,现在我看起来更接近一些,我不禁想知道如果您使用框架而不是内置的PHP会话处理。你是? – pthurmond

+0

我不知道框架 – choppermio

+0

好吧,那么可能基于PHP。然后这应该工作。 $ _SESSION变量是超全局的。我建议你稍微阅读一下。 – pthurmond