Question

I have some questions in mind.

  1. Whether Session id is generated only once ?
  2. Whether Session id is generated again when we refresh(F5) the page ?
  3. Whether Session id is generated again when we reload(Ctrl + F5) the page ?
Was it helpful?

Solution

$_SESSION is a superglobal array which is destroyed only when browser is closed or when you manually destroy the session.

Whenever you send a http request and create a session variable,you indirectly manipulate a file on server which has all data related to your session.Refreshing the page wont generate a new session,instead it will use the same session that you created earlier.

ctrl + 5(hard reload) :will clear the cache,not the session variables.

f5 : simple reload will just reload the page with a possibility that static content might be served by browsers cache

Whether Session id is generated only once ?

ANS : Yes

Whether Session id is generated again when we refresh(F5) the page ?

ANS : No

Whether Session id is generated again when we reload(Ctrl + F5) the page ?

ANS : No

OTHER TIPS

There is no difference F5 or Ctrl+F5. Session generated only once, when you call session_start() at your script.

If you want to regenerate your session, you must call session_regenerate_id() or kill and start session again

  1. session is generated only once. session is generated when you run your script for first time.

2, 3. session id is not generated again when you press F5 or (CTRL + F5)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top