简体   繁体   中英

How to make cakephp session infinite

I just want to inquire about how to make sessions in cakephp to last and be destroyed only when I click logout.

Currently, when I close the browser or just leave the computer, when I get back for like 1 hour, it prompts me to the login page, meaning the Session was deleted.

Facebook in a way does this - unless you logout, your session is stored, so even when you close your browser or leave your computer, you will always be logged in.

From the very top of Cake's Session docs :

Session.timeout - The number of minutes you want sessions to last.

and

Session.cookieTimeout - The number of minutes you want sessions to last. If this is undefined, the value from Session.timeout will be used.

Although you can't make them infinite, try increasingly bigger numbers until you're happy.

<?php
Configure::write('Session', array(
    'timeout' => 4320 //3 days
));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM