在 Zend Framework 中获取会话过期时间 [英] Get Session expiration time in Zend Framework

查看:49
本文介绍了在 Zend Framework 中获取会话过期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Zend Framework 或 PHP 中有没有办法获取会话(PHPSESSID cookie)到期之前的时间?

Is there a way in Zend Framework or PHP to get the time until the Session(PHPSESSID cookie) expires?

推荐答案

我不知道框架提供了任何方法来实现这一点.但是一旦您知道 ZF 将其命名空间的到期时间存储在哪里,您就可以执行以下操作:

I don't know of any method provided by the framework to achieve this. But as soon as you know where ZF stores expiration time for its namespaces, you might be able to do something like this:

$session = new Zend_Session_Namespace( 'Zend_Auth' );
$session->setExpirationSeconds( 60 );

$timeLeftTillSessionExpires = $_SESSION['__ZF']['Zend_Auth']['ENT'] - time();

这篇关于在 Zend Framework 中获取会话过期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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