HTTP, HTTPS protocol session sharing to resolve cookie failure method: (perhaps not the best, but practical)
The principle is to set the session ID to a local cookie,
Copy the Code code as follows:
$currentSessionID = session_id ();
session_id ($currentSessionID);
Simple Case Code:
(HTTP)
Copy the Code code as follows:
Session_Start ();
$currentSessionID = session_id ();
$_session[' testvariable '] = ' SESSION worked ';
$secureServerDomain = ' www.sjolzy.cn ';
$securePagePath = '/safepages/securepage.php '
Echo ' Click here to jump to the HTTPS protocol ';
(HTTPS)
Copy the Code code as follows:
$currentSessionID = $_get[' Session '];
session_id ($currentSessionID);
Session_Start ();
if (!emptyempty ($_session[' testvariable ')) {
echo $_session[' testvariable '];
} else {
Echo ' Session did not work. ';
}
A bit of security issues, because the session ID transmission is not encrypted, others can sniff detect, get the session ID and then get your session data. So consider encrypting this ID if you have to.
A Magento station's cookie setting has been invalidated for many days, and the last awareness is that the HTTP and HTTPS cross-domains invalidate the cookie.