最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP的error_reporting錯(cuò)誤級(jí)別變量對(duì)照表

 更新時(shí)間:2014年07月08日 10:54:15   投稿:junjie  
這篇文章主要介紹了PHP的error_reporting錯(cuò)誤級(jí)別變量對(duì)照表,需要的朋友可以參考下

在PHP中所有的報(bào)錯(cuò)信息可以用error_reporting()這個(gè)函數(shù)來(lái)設(shè)置:

它的參數(shù)有字符串和數(shù)字兩種表示方法,共14個(gè)等級(jí),但是呢,我看使用其他數(shù)字貌似也可以,起初我以為它指的是一定的報(bào)錯(cuò)區(qū)間,后來(lái),終于發(fā)現(xiàn)了其中的規(guī)律:

復(fù)制代碼 代碼如下:
error_reporting( 7 ) = error_reporting( 1+2+4)= error_reporting(E_ERROR | E_WARING | E_PARSE)

現(xiàn)在,我將其總結(jié)如下:

數(shù)字 常量 說(shuō)明
1 E_ERROR 致命錯(cuò)誤,腳本執(zhí)行中斷,就是腳本中有不可識(shí)別的東西出現(xiàn)
舉例: Error:Invalid parameters. Invalid parameter name
2 E_WARNING 部分代碼出錯(cuò),但不影響整體運(yùn)行
舉例: Warning: require_once(E:/include/config_base.php)
4 E_PARSE  字符、變量或結(jié)束的地方寫(xiě)規(guī)范有誤
舉例:  Parse error: syntax error, unexpected $end in
 E_NOTICE 一般通知,如變量未定義等
舉例:  Notice: Undefined variable: p in E:\web\index.php on line 17
16  E_CORE_ERROR PHP進(jìn)程在啟動(dòng)時(shí),發(fā)生了致命性錯(cuò)誤
舉例:  暫無(wú)
32  E_CORE_WARNING 在PHP啟動(dòng)時(shí)警告(非致命性錯(cuò)誤)
舉例:  暫無(wú)
64 E_COMPILE_ERROR 編譯時(shí)致命性錯(cuò)誤
舉例:  暫無(wú)
128 E_COMPILE_WARNING 編譯時(shí)警告級(jí)錯(cuò)誤
舉例:  暫無(wú)
256 E_USER_ERROR  用戶自定義的錯(cuò)誤消息
舉例:  暫無(wú)
512 E_USER_WARNING 用戶自定義的警告消息
舉例:  暫無(wú)
1024 E_USER_NOTICE  用戶自定義的提醒消息
舉例:  暫無(wú)
2047 E_ALL 以上所有的報(bào)錯(cuò)信息,但不包括E_STRICT的報(bào)錯(cuò)信息
舉例:  暫無(wú)
2048 E_STRICT 編碼標(biāo)準(zhǔn)化警告,允許PHP建議如何修改代碼以確保最佳的互操作性向前兼容性。

error_reporting 變量的默認(rèn)值是  E_ALL & ~E_NOTICE
開(kāi)發(fā)時(shí),最佳的值為: E_ALL | E_STRICT

如果設(shè)置為:error_reporting(E_ALL | E_STRICT),則表示記錄所有的錯(cuò)誤信息
可能會(huì)導(dǎo)致網(wǎng)站出現(xiàn)一大堆的錯(cuò)誤代碼;但是對(duì)于程序員來(lái)說(shuō)應(yīng)該說(shuō)是一件好事,可以把代碼優(yōu)化到最優(yōu); 一些非致命性錯(cuò)誤雖然不影響程序的運(yùn)行,但是會(huì)加重PHP的負(fù)擔(dān).


最后,曬出英文版的對(duì)照表:

1 E_ERROR Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted
2 E_WARNING Non-fatal run-time errors. Execution of the script is not halted
4 E_PARSE Compile-time parse errors. Parse errors should only be generated by the parser
8 E_NOTICE Run-time notices. The script found something that might be an error, but could also happen when running a script normally
16 E_CORE_ERROR Fatal errors at PHP startup. This is like an E_ERROR in the PHP core
32 E_CORE_WARNING Non-fatal errors at PHP startup. This is like an E_WARNING in the PHP core
64 E_COMPILE_ERROR Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine
128 E_COMPILE_WARNING Non-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine
256 E_USER_ERROR Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()
512 E_USER_WARNING Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()
1024 E_USER_NOTICE User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()
2048 E_STRICT Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code
4096 E_RECOVERABLE_ERROR Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())
8191 E_ALL All errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)

相關(guān)文章

最新評(píng)論

京山县| 女性| 襄垣县| 剑河县| 邳州市| 崇州市| 峡江县| 芦山县| 新郑市| 那曲县| 大悟县| 裕民县| 合山市| 曲松县| 嘉善县| 万州区| 肥乡县| 仙游县| 陇南市| 盘锦市| 呼和浩特市| 双牌县| 宁陵县| 湘阴县| 南康市| 班戈县| 苏州市| 赣州市| 吕梁市| 贞丰县| 鲁山县| 阿拉善右旗| 宣城市| 高碑店市| 德清县| 孝义市| 德格县| 恩平市| 敖汉旗| 淄博市| 盘山县|