How to increase the session lifetime in Symfony2?

后端 未结 2 454
南旧
南旧 2021-02-06 11:06

I have a login with a remember checkbox. I\'m tring to set lifetime of session to 1 year if the remember checkbox is checked, but no matter what I tried, it doesn\'t work... Sym

2条回答
  •  执念已碎
    2021-02-06 11:43

    It should be done in security.yml configuration file:

    secured_area:
        pattern:  ^/yourpattern
        remember_me:
            key:      "%secret%"
            lifetime: 31536000 # 365 days in seconds
            path:     /yourpath
            domain:   .yourdomain.com
    

    You can find related documentation here.

提交回复
热议问题