The first method: If you do not affect the normal execution of the program, you can use the method of shielding
The first line of the code can be added
Error_reporting (e_all ^ e_notice);
Turn off warnings for notice errors
The second method: navigate to the specific line and follow the prompts to resolve it.
For example ElseIf ($_post[' istrue '] = = ' OK '), such as the above code, did not submit istrue this, so there must be a problem.
can be resolved with the following code
First Judge.
Copy the Code code as follows:
if (array_key_exists (' IsTrue ', $_post))
{
if ($_post[' IsTrue ')
{
$istrue =$_post[' IsTrue '];
}
}else{
$istrue = ";
}
The following judgments can be
Copy the Code code as follows:
ElseIf ($istrue = = ' OK ')
You can avoid this kind of error, you can refer to some of the program's system is if done.
Specific can refer to the code of DEDECMS live Phpcms
Copy the Code code as follows:
Checking and registering variables for external commits
foreach ($_request as $_k=>$_v)
{
if (strlen ($_k) >0 && eregi (' ^ (cfg_| GLOBALS) ', $_k)
{
Exit (' Request var not allow! ');
}
}
Function _runmagicquotes (& $svar)
{
if (!GET_MAGIC_QUOTES_GPC ())
{
if (Is_array ($svar))
{
foreach ($svar as $_k = $_v) $svar [$_k] = _runmagicquotes ($_V);
}
Else
{
$svar = Addslashes ($svar);
}
}
return $svar;
}
foreach (Array (' _get ', ' _post ', ' _cookie ') as $_request)
{
foreach ($$_request as $_k = $_v) ${$_k} = _runmagicquotes ($_v);
}
if (empty ($istrue))
{
$istrue = ";
}
The above describes the Undefined PHP notice:undefined Index Error resolution method, including the Undefined aspect of the content, I hope to be interested in PHP tutorial friends helpful.