Zend-外部注销/结束其他会话 [英] Zend - external logout / ending other sessions

查看:61
本文介绍了Zend-外部注销/结束其他会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Zend Framework编写应用程序,我需要能够按需注销用户.该应用程序将收到包含映射到SessionIds的某种ID的请求,并将结束/终止这些会话.我知道如何进行映射,但是那又如何呢?如何结束具有ID的会话?

I'm writing an app using Zend Framework and I need to be able to logout users on demand. The app will receive a request containing some kind of ID's that are mapped to SessionIds and it will end/expire those sessions. I know how to do the mapping, but what then? How do I end a session having its ID?

我看到有 Zend_Session::setId(),但我认为这不是我想要做的.

I see that there is Zend_Session::setId(), but I don't think this does what I want to do.

我有一个想法就是只删除与给定会话关联的文件,因为它们名为sess_ [sessionId],但是我想这是一种丑陋的方式.

I have an idea to just delete files that are associated with given session, since they are named sess_[sessionId], but I guess that is an ugly way to do it.

推荐答案

您可以将会话信息保存到数据库.它将与会话ID相关.然后创建一个插件来检查数据库行是否仍然存在.如果不是,则执行 Zend_Auth :: getInstance()-> clearIdentity()

You can save session info to the database. It would be related by session id. Then create a plugin that checks if the DB row still exists. If not, then execute Zend_Auth::getInstance()->clearIdentity()

注销用户的方法将从数据库中删除会话.

The method that logs the user out would delete the session from DB.

这篇关于Zend-外部注销/结束其他会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆