通过存储在会话中的变量的值销毁PHP会话
问题描述:
我在我的项目中使用了ZF1
和PHP7
。通过存储在会话中的变量的值销毁PHP会话
我在我的代码设置会话现在登录
$session = new Zend_Session_Namespace()
$session->email = '[email protected]' //recieved via login form
在如下地方,因为我使用的情况下,我要摧毁它具有$session->email
作为[email protected]
会话。
我该怎么做?由于
答
摧毁所有会话只需使用:
Zend_Session::destroy(true);
如果你想detroy specisic会话,使用:
$sess = 'auth'
$namespace = new \Zend_Session_Namespace($sess);
$namespace->unsetAll();
但是,这会破坏该命名空间名称的会话,我想摧毁存储在会话中的值。 –
然后只需将值替换为空 –
^我如何找到与该特定电子邮件的会话 –