Possible Duplicate:
PHP: Notice: Undefined index where the session variable is defined
PHP: “Notice: Undefined variable” and “Notice: Undefined index”PHP公告:未定义的索引错误与会话
好了,这是错误:
Notice: Undefined index: overview_id in C:\xampp\htdocs\site\home.php on line 6
这是我的代码:
<?php session_start();
$sess = $_SESSION["overview_id"];
if(isset($sess)){
header("Location: account.php");
}
?>
任何帮助将是很酷。
谢谢。
$ _SESSION [ “overview_id”]没有定义。就像错误信息所示 – 2012-11-05 23:31:48
这不是一个错误,它是一个*通知*,它只是告诉你一些不错的做法 –
我不明白它:如果你检查'overview_id'元素是否被定义(你用'isset'来检查它),为什么你要创建一个临时变量,给它赋值,然后检查这个变量?为什么不只是'if(isset($ _ SESSION ['overview_id']))'然后呢?我的意思是,这个逻辑背后的推理是什么? – raina77ow