无为清净楼资源网 Design By www.qnjia.com
在PHP中所有的报错信息可以用error_reporting()这个函数来设置:
它的参数有字符串和数字两种表示方法,共14个等级,但是呢,我看使用其他数字貌似也可以,起初我以为它指的是一定的报错区间,后来,终于发现了其中的规律:
复制代码 代码如下:error_reporting( 7 ) = error_reporting( 1+2+4)= error_reporting(E_ERROR | E_WARING | E_PARSE)
现在,我将其总结如下:
数字 常量 说明 1 E_ERROR 致命错误,脚本执行中断,就是脚本中有不可识别的东西出现举例: Error:Invalid parameters. Invalid parameter name 2 E_WARNING 部分代码出错,但不影响整体运行
举例: Warning: require_once(E:/include/config_base.php) 4 E_PARSE 字符、变量或结束的地方写规范有误
举例: Parse error: syntax error, unexpected $end in 8 E_NOTICE 一般通知,如变量未定义等
举例: Notice: Undefined variable: p in E:\web\index.php on line 17 16 E_CORE_ERROR PHP进程在启动时,发生了致命性错误
举例: 暂无 32 E_CORE_WARNING 在PHP启动时警告(非致命性错误)
举例: 暂无 64 E_COMPILE_ERROR 编译时致命性错误
举例: 暂无 128 E_COMPILE_WARNING 编译时警告级错误
举例: 暂无 256 E_USER_ERROR 用户自定义的错误消息
举例: 暂无 512 E_USER_WARNING 用户自定义的警告消息
举例: 暂无 1024 E_USER_NOTICE 用户自定义的提醒消息
举例: 暂无 2047 E_ALL 以上所有的报错信息,但不包括E_STRICT的报错信息
举例: 暂无 2048 E_STRICT 编码标准化警告,允许PHP建议如何修改代码以确保最佳的互操作性向前兼容性。
error_reporting 变量的默认值是 E_ALL & ~E_NOTICE
开发时,最佳的值为: E_ALL | E_STRICT
如果设置为:error_reporting(E_ALL | E_STRICT),则表示记录所有的错误信息
可能会导致网站出现一大堆的错误代码;但是对于程序员来说应该说是一件好事,可以把代码优化到最优; 一些非致命性错误虽然不影响程序的运行,但是会加重PHP的负担.
最后,晒出英文版的对照表:
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月23日
2024年09月23日
- 黑鸭子.2005-《发烧DSD》柏菲[WAV分轨]
- 群星.1990-电影看板·人间道【宝丽金】【WAV+CUE】
- 周殷廷.2024-TO.WHOM.IT.MAY.CONCERN【环球】【FLAC分轨】
- 草蜢.1997-三人世界精选17首【宝丽金】【WAV+CUE】
- 【古琴音乐】管平湖《广陵散》2004[FLAC+CUE]
- 【中国民乐】《少数民族器乐·苗岭的早晨》2004[WAV+CUE]
- 【中国音乐】盛中国《新疆之春》2004[FLAC+CUE]
- 群星《音你而来 第8期》[320K/MP3][44.64MB]
- 群星《音你而来 第8期》[FLAC/分轨][121.21MB]
- 群星《十二女声Ⅲ》[WAV/CUE/分轨][626.4MB]
- 陈百强.1993-离不开...纪念歌集2CD【华纳】【WAV+CUE】
- 于台烟.2003-爱自己【乾坤唱片】【WAV+CUE】
- 群星.2024-我们永远是我们电影原声带【乐禾发文化】【FLAC分轨】
- 【中国民乐】张维良《秋江夜泊》2004[FLAC+CUE]
- 明达年度发烧碟MasterSuperiorAudiophile2011[DSF]