我有2个php页面: https://mydomain/form.php和https://mydomain/paynow.php
脚本form.php具有以下部分代码:
form.php的
session_start();
date_default_timezone_set(@date_default_timezone_get());
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
@header("Content-Type: text/html; charset=UTF-8");
//Some sessions are created after
.......
脚本paynow.php具有以下部分代码:
session_start();
date_default_timezone_set(@date_default_timezone_get());
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
@header("Content-Type: text/html; charset=UTF-8");
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
脚本form.php使用以下方法重定向到paynow.php脚本:
echo "Redirecting you to the Payment page, please wait...";
echo "<script type=\"text/javascript\">top.location.replace('https://mydomain/paynow.php')</script>";
exit;
在paynow.php上,当我将网址更改为top.location.replace('http://mydomain/paynow.php')
时,会话数组为空。它可以正常工作。
有什么想法为什么会这样?