Home  >  Article  >  php教程  >  PHP中提示Notice: Undefined index 的解决方法

PHP中提示Notice: Undefined index 的解决方法

WBOY
WBOYOriginal
2016-06-06 19:44:431875browse

Notice : Undefined index: message in D:\PHPnow-1.5.1\PHPnow-1.5.1\htdocs\Zhongcaoyaocode\index.php on line 4 Notice : Undefined variable: contents in D:\PHPnow-1.5.1\PHPnow-1.5.1\htdocs\Zhongcaoyaocode\index.php on line 32 Notice : Use of

Notice: Undefined index: message in D:\PHPnow-1.5.1\PHPnow-1.5.1\htdocs\Zhongcaoyaocode\index.php on line 4

Notice
: Undefined variable: contents in D:\PHPnow-1.5.1\PHPnow-1.5.1\htdocs\Zhongcaoyaocode\index.php on line32

Notice: Use of undefined constant id - assumed 'id' inD:\PHPnow-1.5.1\PHPnow-1.5.1\htdocs\Zhongcaoyaocode\index.php on line33


为了方便程序修改,可以用以下方法:

在开头加上 
error_reporting(E_ALL & ~E_NOTICE); // 这句话表示提示除去 E_NOTICE 之外的所有错误信息 

或者在每个文件头上加

error_reporting(0);

这样以来,Notice信息就不再显示了。

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