0 votes
in PHP by
What is $_SESSION in PHP?

1 Answer

0 votes
by

A session creates a file in a temporary directory on the server where registered session variables and their session id are stored. This data will be available to all pages on the site amid that visit.

The area of the temporary record is controlled by a setting in the php.ini document called session.save_path.

At the point when a session is begun following things happen -

PHP first makes two duplicates of one of a kind session id for that particular session of the client which is an arbitrary string of 32 hexadecimal numbers, for example, 3c7foj34c3jjhkyepop2fc937e3443.

One copy of unique session id automatically sent to the user in PHP?s computer for the sake of synchronization in future ahead, and one copy is being maintained at server side till the session is running.

Whenever you want to access the page of website or web app, then session id of the current user will be associated with the HTTP header, and that will be compared by the session id which is being maintained at the server. After completing the comparison process, you can easily access the page of the website or web app

A session ends when the user closes the browser, or after leaving the site, the server will terminate the session after a predetermined period, commonly 30 minutes duration.

Related questions

0 votes
+1 vote
asked May 13, 2022 in PHP by john ganales
+1 vote
asked May 13, 2022 in PHP by john ganales
...