CakePHP Session Timeout on Inactivity only

前端 未结 5 595
别跟我提以往
别跟我提以往 2020-12-05 00:45

So the crux of this question is just how to prevent CakePHP from de-authenticating a session ONLY after a period of inactivity.

So, if the user does nothing then I e

5条回答
  •  盖世英雄少女心
    2020-12-05 01:04

    the answer of Rob Forrest is the right one

    Configure::write('Session', array(
            'defaults' => 'php',
            'timeout' => 30, // The session will timeout after 30 minutes of inactivity
            'cookieTimeout' => 1440
    ));
    

    cookieTimeout should be larger than timeout if you want session to be expired on inactivity only then you need to set cookieTimeout for very large number (for example 60*24*10 (10 days ))

提交回复
热议问题