PHP会话从HTTPS页面丢失到HTTPS

时间:2016-02-28 14:47:35

标签: php session https

我有2个php页面: https://mydomain/form.phphttps://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')时,会话数组为空。它可以正常工作。

有什么想法为什么会这样?

我的会话配置如下: enter image description here

0 个答案:

没有答案