即使在浏览器关闭或系统关闭后,会话仍然存在

I want to keep the session of user logged in to my website to persist even after the user turns off the browser or the user shuts down its system. The user session will exist until he logs out or clears the browser cookie.

Currently I have user ini_set("session.cookie_lifetime",2678400); which will keep the session to persist for a month.

The behavior is as follow:

  1. User visits the site. Logs in. The session is set and exist.
  2. User turns the browser off.
  3. User again visits to the site. I check the cookie name of session id, which was same as the cookie name of session id set earlier.
  4. The user session is same. But the log in doesn't show. Also If I browse, the user session is shown after browsing 2-3 pages. Even though i didn't logged in again.

Can anyone tell why is it that the login session is not shown as the user opens the browser and comes to site and shown after several refresh of same page or browsing other pages.

any help ?