duang8642 2017-04-24 08:56 采纳率: 0%
浏览 41

如何增加cakephp 2的登录时间

Can you please let me know how to increase the session expiry time for CakePHP 2?

Currently, i set the configuration as bellow.

Configure::write('Session', array(
        'defaults' => 'php',
                'timeout' => 129600, // The session will timeout after 30 minutes of inactivity
                'cookieTimeout' => 129600, // The session cookie will live for at most 24 hours, this does not effect session timeouts
                'ini' => array(
                   'session.gc_maxlifetime' => 129600 // 36 hours
                 )
    ));

But, these settings not work and session expired in almost 24 minutes.Thanks This thread didn't solve my problem "How to increase cakephp Auth component session expire time"

  • 写回答

1条回答 默认 最新

  • dongsheng4126335 2017-04-24 09:51
    关注

    Add this configuration in core.php file of your application

    Configure::write('Session', array(
    'defaults' => 'cache',//default session
    'timeout'  => '<time_in_minute>',//in minutes
    'cookieTimeout' => '<time_in_minute>',//in minutes
    'ini' => array('session.cookie_domain' => env('HTTP_BASE')),
    'handler' => array(
        'config' => '<handler>' //if you are using default sessions then this field is not necessary
     )
    ));
    

    Add time according to your requirement

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试