在 zend 框架中离开控制器时如何清除会话?

发布于 2024-11-28 18:02:02 字数 111 浏览 4 评论 0原文

假设我在IndexController的indexAction中。我在会话中存储了一些数据。现在,当我移动到另一个控制器(假设是ExampleController)时,我想清除所有会话。我怎样才能做到这一点?

Assume that I'm in indexAction of IndexController. I stored some data in session. Now I want to clear all session when I move to another controller, let's say that ExampleController. How can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只为一人 2024-12-05 18:02:02

如果要清除所有会话命名空间:

Zend_Session::destroy();

要清除一个特定的命名空间:

 Zend_Session::namespaceUnset('default');

If you want to clear all Session namespaces:

Zend_Session::destroy();

To clear one specific nameSpace:

 Zend_Session::namespaceUnset('default');
辞旧 2024-12-05 18:02:02

也许与

$bootstrap = $this->getInvokeArg('bootstrap');
$cache = $bootstrap->getResource('cache');
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);

maybe with

$bootstrap = $this->getInvokeArg('bootstrap');
$cache = $bootstrap->getResource('cache');
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文