【问题标题】:PHP session variables are not being storedPHP会话变量没有被存储
【发布时间】:2014-05-26 17:09:41
【问题描述】:

我有两个脚本, 第一个:

    <?php
//this is the first script with a link to the second
session_start();
$_session['k']='kellogs';
$_session['w']='weetabix';
?>
<html>
<a href="2.php">see me</a>
</html>

第二个脚本

    <?php
//this script displays the variables stored in 1.php
session_start();
echo $_session['k'];
echo "<br>";
echo $_session['w'];
?>
<html>
<a href="1.php">see me</a>
</html>

问题是我收到一条错误消息说未定义变量_session。我在两个脚本中都使用了启动会话方法,当我回显 session_id() 时,我可以看到会话存在,为什么?我在 wamp 服务器 2.2 上使用 php 5.4.3。任何帮助将不胜感激。

【问题讨论】:

    标签: php session


    【解决方案1】:

    $_SESSION 是一个superglobal 数组,它必须是CAPITAL / BLOCK 字母。

    【讨论】:

      猜你喜欢
      • 2013-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-10
      • 1970-01-01
      相关资源
      最近更新 更多