当前位置:Gxlcms > PHP教程 > 预定义异常-PHP手册笔记

预定义异常-PHP手册笔记

时间:2021-07-01 10:21:17 帮助过:27人阅读

Exception是所有异常的基类,类摘要如下:

  1. <code><!--?php
  2. class Exception {
  3. protected string $message; // 异常消息内容
  4. protected int $code; // 异常代码
  5. protected string $file; // 抛出异常的文件名
  6. protected int $line; // 抛出异常在该文件的行号
  7. public __construct([string $message = "" [, int $code = 0 [, Exception $previous = NULL]]])
  8. final public string getMessage(void)
  9. final public Exception getPrevious(void)
  10. final public int getCode(void)
  11. final public string getFile(void)
  12. final public int getLine(void)
  13. final public array getTrace(void)
  14. final public string getTraceAsString(void)
  15. public string __toString(void)
  16. final private void __clone(void)
  17. }</code--></code>

ErrorException是错误异常,类摘要如下:

  1. <code><!--?php
  2. class ErrorException extends Exception {
  3. protected int $severity; // 异常级别
  4. public __construct([string $message = "" [, int $code = 0 [, int $severity = 1 [, string $filename = __FILE__ [, int $lineno = __LINE__ [, Exception $previous = NULL]]]]]])
  5. final public int getSeverity(void)
  6. }</code--></code>

(全文完)

以上就介绍了预定义异常 - PHP手册笔记,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行