laravel5.1 How to implement the timeout automatic logout?

Source: Internet
Author: User
Title said, I set the config/session.php in lifetime = 10 but more than 10 minutes is still not logged out, how to set, set where or need to change what files can be done automatically log out of the operation?

Reply content:

Title said, I set the config/session.php in lifetime = 10 but more than 10 minutes is still not logged out, how to set, set where or need to change what files can be done automatically log out of the operation?

Session is automatically refreshed this 10 minutes is the automatic destruction of 10 minutes when the user does not have any action such as a page refresh I estimate you are there in the process of refreshing the page or other actions

This is not by the framework to achieve the general, is directly set the session's life cycle, not set the default browser close the end.
Of course, you're a Virgo. The framework must be used to control, only write cache records the last operation time to determine whether expired.

Lifetime only specifies the number of seconds after which the data is considered "junk" and cleared, which is a chance. Not 100% deleted.
(Depends on session.gc_probability and session.gc_divisor). You can take a look at the PHP documentation.

If you want to delete it for 10 minutes, you can do it in code. if (Time ()-$_session[' time '] > 10*60) {session_destory ()}

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.