How to use session first when disabling cookie on the PHP client: add a PHPSESSID $ sid on each hyperlink to prevent the new sessionif (isset ($ _ GET [& quot; PHPSESSID & quot;]) {& nbsp; session_id ($ _ GET [& quot; PHPSESSID & quot;]);} PHP client disabling cookie how to use session
Method 1: Add a PHPSESSID = $ sid on each hyperlink
// Prevent new sessions from being generated when the initial page is returned
If (isset ($ _ GET ["PHPSESSID"]) {
Session_id ($ _ GET ["PHPSESSID"]);
}
// Start a session
Session_start ();
// Obtain the session_id () of the current session ()
$ Sid = session_id ();
// Add the PHPSESSID = $ sid parameter to each link
Other pages can be obtained as follows:
If (isset ($ _ GET ["PHPSESSID"]) {
// Set the current session to the initial session, and the session_id () is consistent.
Session_id ($ _ GET ["PHPSESSID"])
}
Session_start ();
Method 2: Use the SID constant to replace PHPSESSID = $ sid on the link (the SID value is similar to PHPSESSID = sddg34r593dfdlksrewr)
If (isset ($ _ GET ["PHPSESSID"]) {
Session_id ($ _ GET ["PHPSESSID"]);
}
// Start a session
Session_start ();
Other pages can be obtained as follows:
If (isset ($ _ GET ["PHPSESSID"]) {
// Set the current session to the initial session, and the session_id () is consistent.
Session_id ($ _ GET ["PHPSESSID"])
}
Session_start ();
Method 3: Use session. use_trans_sid = 1, which is configured in php. ini.
In this way, the SID (href, location, action) is automatically added to the url. note: SID is not added to js redirection)