PHP 会话变量未设置 [英] PHP Session variable not getting set

查看:40
本文介绍了PHP 会话变量未设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们网站的一个页面中,我有以下代码:

In one page of our site, I have this code:

$_SESSION['returnURL'] = "/store/checkout/onepage";

再往下,这个按钮控制:

and further down, this button control:

<button type="button" title="Register Today" class="button" onclick="window.location = '/register/';" id="BecomeMember"><span><span>Become a Member Today</span></span></button>

现在,在注册模板中,我有这个代码:

Now, in the register template, I have this code:

<input type="hidden" name="returnURL" id="returnURL" value="<?php if(isset($_SESSION['returnURL'])) { echo $_SESSION['returnURL']; } else { echo '/'; } ?>" />

但它只将值显示为/.

是什么导致了这种情况?

What could be going on that is causing this?

推荐答案

我最终做的是向页面发送一个 post 变量.ExpressionEngine 和 Magento 之间会话的差异使得这禁止使用会话变量和 cookie.

What I ended up doing was sending a post variable to the page. The difference in the sessions between ExpressionEngine and Magento makes this prohibitive using session variables as well as cookies.

这篇关于PHP 会话变量未设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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