Home >Backend Development >PHP Tutorial >PHP client disables cookies and how to use session_PHP tutorial
First way: add a PHPSESSID=$sid on each hyperlink
//Prevent returning to the initial page to generate a new session
if(isset($_GET["PHPSESSID"])){
Session_id($_GET["PHPSESSID"]);
}
//Start a session
session_start();
//Get the session_id()
of the current session
$sid=session_id();
//Add parameter PHPSESSID=$sid
How to obtain other pages:
if(isset($_GET["PHPSESSID"])){
//Set the current session as the initial session, and the session_id() is consistent
Session_id($_GET["PHPSESSID"])
}
session_start();
Second way: Use SID constant to replace PHPSESSID=$sid on the link (SID value is similar: PHPSESSID=sddg34r593dfdlksrewr)
if(isset($_GET["PHPSESSID"])){
Session_id($_GET["PHPSESSID"]);
}
//Start a session
session_start();
How to get other pages:
if(isset($_GET["PHPSESSID"])){
//Set the current session as the initial session, and the session_id() is consistent
Session_id($_GET["PHPSESSID"])
}
session_start();
The third way: use session.use_trans_sid=1, configure in php.ini
This method will automatically add SID (href, location, action, note: js jump will not add SID) to the url