Ask for the PHP code to set the validity period of the session of the administrator account. for example, after the administrator logs on, the session becomes invalid if the page is not refreshed for 10 minutes. when requesting the page again, he needs to log on again. ------ Solution ------------------ use session to record the last logon time as the current time. Compare the current time-last logon time with 10 minutes. If the value is greater than 10 minutes, the session is destroyed. Otherwise, update sessi and request PHP to set the validity period code of the session of the administrator account.
For example, if the session becomes invalid 10 minutes after the administrator logs on to the page, he or she needs to log on again when requesting the page again.
------ Solution --------------------
Use session to record the last logon time as the current time. Compare the current time-last logon time with 10 minutes. If the value is greater than 10 minutes, the session is destroyed. Otherwise, the session is updated to the current time.
------ Solution --------------------
Write cookie
------ Solution --------------------
Php session should be 1440 s by default, that is, 24 min
You can modify it from php. ini.
You can also write it like this.
Session. gc_maxlifetime = "600"; // Here is the valid time
------ Solution --------------------
Discussion
Php session should be 1440 s by default, that is, 24 min
You can modify it from php. ini.
You can also write it like this.
Session. gc_maxlifetime = "600"; // Here is the valid time