Zend framework session expires prematurely

前端 未结 5 953
既然无缘
既然无缘 2020-12-14 21:28

I\'m using Zend Framework for PHP and handling sessions with the Zend_Session module. This is what I have in my Initializer (or bootstrap):

Zend_Session::st         


        
5条回答
  •  有刺的猬
    2020-12-14 21:57

    Try calling remember me before starting the session:

    Zend_Session::rememberMe(864000);
    Zend_Session::start();
    

    Otherwise I believe it will use the default of remember_me_seconds. See 49.4.4. rememberMe(integer $seconds)

    Also, does anyone know how I can make it so that the session never expires? I've tried setting the second to 0 and -1, but that throws an error.

    I don't think that is possible. The session is controlled by whether the cookie exists on the users computer. Those cookies can be deleted, even by the users if they clear their cache. I think the best you can do is set it to a very large number. Say 12 months.

提交回复
热议问题