国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

PHP的error_reporting錯誤級別變量對照表

2020-03-22 20:11:07
字體:
來源:轉載
供稿:網友
在PHP中所有的報錯信息可以用error_reporting()這個函數來設置:它的參數有字符串和數字兩種表示方法,共14個等級,但是呢,我看使用其他數字貌似也可以,起初我以為它指的是一定的報錯區間,后來,終于發現了其中的規律:
復制代碼 代碼如下:error_reporting( 7 ) = error_reporting( 1+2+4)= error_reporting(E_ERROR | E_WARING | E_PARSE)現在,我將其總結如下:
致命錯誤,腳本執行中斷,就是腳本中有不可識別的東西出現
舉例: Error:Invalid parameters. Invalid parameter name
部分代碼出錯,但不影響整體運行
舉例: Warning: require_once(E:/include/config_base.php)
字符、變量或結束的地方寫規范有誤
舉例:Parse error: syntax error, unexpected $end in
一般通知,如變量未定義等
舉例:Notice: Undefined variable: p in E:/web/index.php on line 17
error_reporting 變量的默認值是 E_ALL & ~E_NOTICE
開發時,最佳的值為: E_ALL | E_STRICT如果設置為:error_reporting(E_ALL | E_STRICT),則表示記錄所有的錯誤信息
可能會導致網站出現一大堆的錯誤代碼;但是對于程序員來說應該說是一件好事,可以把代碼優化到最優; 一些非致命性錯誤雖然不影響程序的運行,但是會加重PHP的負擔.
最后,曬出英文版的對照表:
E_ERROR Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted
E_PARSE Compile-time parse errors. Parse errors should only be generated by the parser
E_NOTICE Run-time notices. The script found something that might be an error, but could also happen when running a script normally
E_CORE_WARNING Non-fatal errors at PHP startup. This is like an E_WARNING in the PHP core
E_COMPILE_ERROR Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine
E_COMPILE_WARNING Non-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine
E_USER_ERROR Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()
E_USER_WARNING Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()
E_USER_NOTICE User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()
E_STRICT Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code
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())
E_ALL All errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 崇州市| 治多县| 德清县| 墨玉县| 嵩明县| 泸水县| 观塘区| 清水河县| 甘洛县| 伊金霍洛旗| 通城县| 苏尼特右旗| 济源市| 贡觉县| 延边| 克拉玛依市| 黄龙县| 紫阳县| 林周县| 上栗县| 吴桥县| 罗平县| 平和县| 定州市| 马关县| 盘锦市| 金乡县| 武义县| 五峰| 错那县| 乃东县| 桓仁| 天镇县| 林西县| 瑞安市| 梨树县| 高安市| 泽库县| 无为县| 陆川县| 万山特区|