php error_reporting() 设置错误报告级别

php中文网
发布: 2016-07-25 08:51:23
原创
1238人浏览过
  1. * For now, avoid warnings of E_STRICT mode
  2. * (this must be done before function definitions)
  3. */
  4. if (defined(’E_STRICT’)) {
  5. $old_error_reporting = error_reporting(0);
  6. if ($old_error_reporting & E_STRICT) {
  7. error_reporting($old_error_reporting ^ E_STRICT);
  8. } else {
  9. error_reporting($old_error_reporting);
  10. }
  11. unset($old_error_reporting);
复制代码

常见的如下:

  1. // turn off all error reporting;关闭所有的错误

  2. error_reporting(0);
  3. // Report simple running errors;报告一个简单的运行错误

  4. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  5. // Reporting E_NOTICE can be good too (to report uninitialized

  6. // variables or catch variable name misspellings …);包括报告一些未初始化的变量或捕捉变量名的拼写错误
  7. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

  8. // Report all errors except E_NOTICE
  9. // This is the default value set in php.ini;报告所有的错误但不包括E_NOTICE
  10. error_reporting(E_ALL ^ E_NOTICE);

    Flawless AI
    Flawless AI

    好莱坞2.0,电影制作领域的生成式AI工具

    Flawless AI 32
    查看详情 Flawless AI
  11. // Report all PHP errors (bitwise 63 may be used in PHP 3);报告所有的错误

    立即学习PHP免费学习笔记(深入)”;

  12. error_reporting(E_ALL);

  13. // Same as error_reporting(E_ALL);同上
  14. ini_set(’error_reporting’, E_ALL);
复制代码


PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号