Why do I set Ini_set ("Session.gc_maxlifetime", 1);

Source: Internet
Author: User
 
  

I set the Ini_set ("Session.gc_maxlifetime", 1); The session is valid for 1 minutes.
I'll be back in a minute. test.php in the same folder how can I get the value of $_session["name"? Should it be a null value?
It's still available for 2 hours.
What else do I need to set up?

 
  

This is my test.php code.


Reply to discussion (solution)

I'm a novice too.
If you don't mind, give me a little advice, or try it.

Put
Ini_set ("Session.gc_maxlifetime", 1);

Put to Session_Start (); The back

I'm a novice too.
If you don't mind, give me a little advice, or try it.

Put
Ini_set ("Session.gc_maxlifetime", 1);

Put to Session_Start (); The back


Have you done this before?


I'm a novice too.
If you don't mind, give me a little advice, or try it.

Put
Ini_set ("Session.gc_maxlifetime", 1);

Put to Session_Start (); The back


Have you done this before?


I've tried it before.
It does make time work.

But in other code has also been modified, do not know whether this is the most direct reason

Sessions time

Modified time is not enough, PHP has a GC mechanism, that is, garbage collection mechanism, the default is only 1/100 or 1/1000 of the probability of the session file after the expiration time to delete files, you can modify Session.gc_divisor = 1,session.gc_ Probability = 1, this is the session file expires, the session initialization action triggered by the session file has a 100% probability of being deleted

  • 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.