【发布时间】: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。任何帮助将不胜感激。
【问题讨论】: