PHP 注意:未定义的索引 PHP Notice: Undefined index

示例

原因:

尝试通过数组中不存在的键访问数组

可能的解决方案:

访问前请检查可用性。采用:

  1. isset()

  2. array_key_exists()