Why do I set ini_set (session. gc_maxlifetime, 1); invalid?
I set ini_set ("session. gc_maxlifetime", 1); the session is valid for 1 minute.
How can I get the value of $ _ SESSION ["name"] after I access test. php in the same folder one minute? Should it be null?
After 2 hours, you can still get it.
What else do I need to set?
This is my test. php code.
Reply to discussion (solution)
I am also a newbie
If you don't mind, give me a small suggestion. try again...
Set
Ini_set ("session. gc_maxlifetime", 1 );
Put it behind session_start ();
I am also a newbie
If you don't mind, give me a small suggestion. try again...
Set
Ini_set ("session. gc_maxlifetime", 1 );
Put it behind session_start ();
Have you done this before?
I am also a newbie
If you don't mind, give me a small suggestion. try again...
Set
Ini_set ("session. gc_maxlifetime", 1 );
Put it behind session_start ();
Have you done this before?
I tried before
This makes time effective.
But it has been modified in other codes. I don't know if this is the most direct reason.
Sessions time
The modification time is not enough. php has a gc mechanism, that is, the garbage collection mechanism. by default, only 1/100 or 1/1000 of the probability will be deleted after the session file expires, you can modify the session. gc_pisor = 1, session. gc_probability = 1. after the session file expires, the session file is deleted with a 100% probability when the session file is triggered by the session initialization action.