The first method: If it does not affect the normal execution of the program, you can use the shielding method
You can add
error_reporting(E_ALL ^ E_NOTICE);
to the first line of the code to close Get rid of NOTICE error warning
The second method: locate the specific line and solve it according to the prompts.
For example, elseif ($_POST['istrue'] == 'ok'), as shown in the above code, does not submit istrue, so there must be a problem.
Can be solved with the following code
First judge the above
Copy the code The code is as follows:
if (array_key_exists( 'istrue',$_POST))
{
if($_POST[ 'istrue'])
{
$istrue=$_POST[ 'istrue'];
}
}else{
$istrue='';
}
The following judgment can be as follows
Copy code The code is as follows:
elseif ($istrue == 'ok')
You can avoid such errors. You can refer to the system of some programs. Made.
For details, please refer to the code of dedecms and phpcms
Copy the code The code is as follows:
//Check and register external Submitted variables
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 = '';
}
http://www.bkjia.com/PHPjc/322454.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322454.htmlTechArticleThe first method: If it does not affect the normal execution of the program, you can use the shielding method. Add error_reporting(E_ALL ^ E_NOTICE); to turn off the NOTICE error alert...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn