时间:2021-07-01 10:21:17 帮助过:14人阅读
原理就是把session id设置到本地的cookie,
代码如下:
$currentSessionID = session_id();
session_id($currentSessionID );
(HTTP)
代码如下:
session_start();
$currentSessionID = session_id();
$_SESSION['testvariable'] = 'Session worked';
$secureServerDomain = 'www.sjolzy.cn';
$securePagePath = '/safePages/securePage.php'
echo '点击这里跳转到HTTPS 协议下';
代码如下:
$currentSessionID = $_GET['session'];
session_id($currentSessionID);
session_start();
if (!emptyempty($_SESSION['testvariable'])) {
echo $_SESSION['testvariable'];
} else {
echo 'Session did not work.';
}
一个magento站的cookie设置一直失效,纠结好多天,最后明悟是HTTP和HTTPS跨域 使COOKIE失效了。。