简体   繁体   中英

Notice: Undefined index in XAMPP V3.2.1

我刚刚安装了最新版本的XAMPP,并且正在收到Notice: Undefined index:对于带有$_POST$_GET任何变量,我试图关闭错误报告的通知,但未进行任何更改。

You should always make use of the isset construct before checking the values of $_POST or $_GET values..

Something like this..

<?php
if(!isset($_GET['id']))
{
echo "Value was not passed or set. Let me go and check the form !";
}

What @Shankar said is true, but Notice errors are not important in php , you can turn them of easily without any problem by putting

 error_reporting(E_ALL ^ E_NOTICE)

in the first line of your application.

Refrence

There are 2 ways to fix this.

  1. Check if the variable is set by surrounding the $_POST with isset()
  2. Add error_reporting(E_ALL ^ E_NOTICE) to the first line of your script.

This type of error is not important inside of php and is just a warning letting you know that you did not check if it was set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM