我有这个程序:
if (!isset($_POST['foo'])) doSomeThing1();
else {
if (!array_key_exists('foo',$_POST)) doSomeThing2();
else doSomeThing3();
}
但是...程序流程转到 3d 案例,失败并出现错误:undefined index 'foo' (in file.php, line xxx)
.
你能解释一下,为什么?为什么array_key_exists
返回true
(将脚本带到 3d 案例)但随后它是“未定义的索引”?