Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Session expiration time in Zend Framework

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

like image 631
fsteinbauer Avatar asked Feb 28 '11 18:02

fsteinbauer


1 Answers

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();
like image 154
Vika Avatar answered Oct 27 '22 19:10

Vika