Want to store sessions using zend Framework
I need to set up a remember me function for users who log into my website so everytime they close the browser they do not need to relogin to the website. I'm using the zend framework here and have tried to use a bit of Zend_Session code. I created a table and sessions are being written to the table. However when I close the browser and open up the site again - I need to relogin manually again.
This is the code for setting up sessions in my bootstrap file.
$config = array(
'name' => 'session',
'primary' => 'id',
'modifiedColumn' => 'modified',
'dataColumn' => 'data',
'lifetimeColumn' => 'lifetime'
);
//create your Zend_Session_SaveHandler_DbTable and
//set the save handler for Zend_Session
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
//start your session!
Zend_Session::start();
Where am I missing something - as far as I know this is teh only session management related code in my site so I'm definitely missing out here. I have set up stor开发者_StackOverflowed sessions earlier in earlier websites however this time I need to do it using the zend framework libraries.
Simply add after your Login Code:
// remember session for XYZ time (5000)
Zend_Session::rememberMe(5000)
精彩评论