magento中的会话超时事件 [英] Session timeout event in magento

查看:90
本文介绍了magento中的会话超时事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户注销时执行一些自定义功能,因此我迷上了客户注销事件,并为其添加了一个观察者.

I wanted to do some custom functionality upon user logout, so I hooked to the customer logout event, and added an observer to it.

这是config.xml中的配置

Here's the configuration in config.xml

<customer_logout>
  <observers>
    <cwmyaccount>
      <type>singleton</type>
      <class>KrtMalta_Myaccount_Model_Observer</class>
      <method>setRegularCustomer</method>
    </cwmyaccount>
  </observers>
</customer_logout>

但是,我希望即使在会话超时时也要执行我的自定义功能.我查找了google和Magento文件,但几乎没有成功.是否有可能以某种方式挂接到会话超时?

However I'd like the execute my custom functionality even on session-timeout. I've looked up google and Magento files with pretty much no success. Is it possible to hook to session-timeout somehow?

推荐答案

在启动会话时,PHP将自动清理会话,除非您编写自己的

Sessions are cleaned up automatically by PHP when a session is started and there is currently no way to hook into this process unless you write your own custom session handler.

如果您编写自己的处理程序,则PHP将调用您的 gc 方法,使您可以控制被破坏的旧会话数据.请记住,这是在请求开始时(在调用session_start()时发生的),因此您希望您所做的任何处理都非常快,以免延迟正在处理的请求.

If you write your own handler, then PHP will call your gc method giving you control over the old session data that gets destroyed. Keep in mind that this happens at the start of the request (when session_start() is called) so you would want whatever processing you do to happen very quickly as not to delay the request being processed.

这篇关于magento中的会话超时事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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