Session sharing under HTTP and HTTPS protocol solutions to Cookie invalidation: (perhaps not the best, but practical)
The principle is to set the session ID to a local cookie,
Copy Code code as follows:
$currentSessionID = session_id ();
session_id ($currentSessionID);
Simple Case Code:
(HTTP)
Copy Code code as follows:
Session_Start ();
$currentSessionID = session_id ();
$_session[' testvariable '] = ' session worked ';
$secureServerDomain = ' www.sjolzy.cn ';
$securePagePath = '/safepages/securepage.php '
Echo ' <a href= ' https://'. $secureServerDomain. $securePagePath. ' session= '. $currentSessionID. ' > Click here to jump to the HTTPS protocol </a> ';
(HTTPS)
Copy 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 little security problem, because such a Word session ID transmission is not encrypted, others can sniff detect, get this session ID and then get your session data. So you can consider encrypting this ID if necessary.
A Magento station cookie set has been invalidated for many days, and finally realized that the HTTP and HTTPS Cross-domain make the cookie invalid.