$ _SESSION变量不会转到另一个页面。 [英] $_SESSION variable not going to another page.

查看:74
本文介绍了$ _SESSION变量不会转到另一个页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个$ _SESSION不会转到另一个页面,如果我在回显的第一页回显它:

One of my $_SESSION is not going to another page if I echo it in the first page the echo is:

BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors with VGA AV BNC USB HDMI Inputs Display: 1 |-| XXL BBQ: 1 |-| Single Bed: 1 |-|





但是当我在另一页上调用它时,我得到一个没有值的空SESSION。



我的尝试:



第1页:

(cartOutput给出以下结果:



But when I call it on the other page I get one empty SESSION without value.

What I have tried:

1st PAGE:
( cartOutput gives the following result:

BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors with VGA AV BNC USB HDMI Inputs Display: 1 |-| XXL BBQ: 1 |-| Single Bed: 1 |-|

这意味着我告诉那个

$_SESSION['checkoutTotal']

等于

$cartOutput







$cartOutput = "BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors with VGA AV BNC USB HDMI Inputs Display: 1 |-| XXL BBQ: 1 |-| Single Bed: 1 |-|";
$_SESSION['checkoutTotal'] = $cartOutput;

echo $_SESSION['checkoutTotal'];





回音结果:



echo result:

BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors









第2页有以下代码:







2nd page have the following code:

if(isset($_SESSION["checkoutTotal"])) {
echo "Products: ".$_SESSION['checkoutTotal'];
}
else
{
    echo "Session not set yet.";
}





,结果是



and the result is

Session not set yet.

推荐答案

如果我在回声的第一页回应它,_SESSION不会转到另一页:
_SESSION is not going to another page if I echo it in the first page the echo is:
BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors with VGA AV BNC USB HDMI Inputs Display: 1 |-| XXL BBQ: 1 |-| Single Bed: 1 |-|





但是当我在另一页上调用它时,我得到一个没有值的空SESSION。



我的尝试:



第1页:

(cartOutput给出以下结果:



But when I call it on the other page I get one empty SESSION without value.

What I have tried:

1st PAGE:
( cartOutput gives the following result:

BG-12 Pull Station Fire Alarm Security: 1 |-| EPDM Double Jacket Fire Hose: 1 |-| Coolcam HD 1080P Wireless WiFi 2way Audio with Night Vision and Motion Detect: 1 |-| 12inch CCTV TFT LCD Monitors with VGA AV BNC USB HDMI Inputs Display: 1 |-| XXL BBQ: 1 |-| Single Bed: 1 |-|

这意味着我告诉


_SESSION ['checkoutTotal']
_SESSION['checkoutTotal']

等于


cartOutput
cartOutput








这篇关于$ _SESSION变量不会转到另一个页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆