Get Session expiration time in Zend Framework

2019-03-15 17:58发布

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

1条回答
狗以群分
2楼-- · 2019-03-15 18:12

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();
查看更多
登录 后发表回答