I don't exactly understand how does session_start
work ? For example, here is a script named :
tester.php
<html>
<body> <head> <title> tester.php </title> </head>
<?php
session_start();
$_SESSION['Mir Taqi Mir'] = "Dekh toh dil ke jaan se uthta hai,yeh dhuan sa kahaan se uthta hai";
?>
<a href='./try.php'>Click to follow</a>
</body>
</html>
and a script named try.php
:
session_start();
if(isset($_SESSION['Mir Taqi Mir']))
{
echo "Value of the session variable :".$_SESSION['Mir Taqi Mir'];
}
When I follow down to try.php
from tester.php
how does session_start
know that it has to resume a session and not start a new session ?
The documentation states : session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
What identifier ? I do not understand this.