0
I can do more one session in just one site?
2 Answers
+ 5
Yes! You can use multiple session_start(); statements and use the session_id(); function to distinguish between different sessions.
For example:
<?php
//Start first session and set a value
session_id("session_A");
session_start();
$_SESSION["name"] = "A";
session_write_close();
//Start second session and set a value
session_id("session_B");
session_start();
$_SESSION["name"] = "B";
session_write_close();
//Get the values
session_id("session_A");
session_start();
echo $_SESSION["name"];
session_write_close();
session_id("session_B");
session_start();
echo $_SESSION["name"];
session_write_close();
?>
+ 1
Yes