Get Session expiration time in Zend Framework

柔情痞子 提交于 2019-12-20 12:35:30

问题


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


回答1:


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();


来源:https://stackoverflow.com/questions/5146217/get-session-expiration-time-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!