PHP的错误机制总结

2017-01-07 00:00:00少芬 网页程序设计

  PHP的错误机制也是非常复杂的,PHP的错误级别有哪些?截至到php5.5,PHP一共有16个错误级别,一起来看看吧!

  注意:尝试下面的代码的时候请确保打开error_log:

  error_reporting(E_ALL);

  ini_set('display_errors', 'On');

  E_ERROR

  这种错误是致命错误,会在页面显示Fatal Error, 当出现这种错误的时候,程序就无法继续执行下去了

  错误示例:

  // Fatal error: Call to undefined function hpinfo() in /tmp/php/index.php on line 5

  hpinfo();  //E_ERROR

  注意,如果有未被捕获的异常,也是会触发这个级别的。

  // Fatal error: Uncaught exception 'Exception' with message 'test exception' in /tmp/php/index.php:5 Stack trace: #0 {main} thrown in /tmp/php/index.php on line 5

  throw new Exception("test exception");

  E_WARNING ..........

阅读全文

[网页程序设计]相关推荐

[网页程序设计]相关栏目推荐
查看更多
上一篇:ASP基本的语法规则 下一篇:CSS高级布局技巧