我刚刚安装了最新版本的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.
There are 2 ways to fix this.
$_POST
with isset()
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.