PHP 异常与错误 —— Throwable

Throwable

官方文档地址: http://php.net/manual/en/class.throwable.php

PHP 支持版本: 7

Throwable 是 PHP 7 中可以用作任何对象抛出声明的基本接口,包括 Expection (异常)和 Error (错误)。

 1 Throwable {
 2   /* 方法 */
 3   abstract public string getMessage ( void ) // 获取抛出的消息内容
4 abstract public int getCode ( void ) // 获取抛出的错误代码
5 abstract public string getFile ( void ) // 获取产生异常的文件名
6 abstract public int getLine ( void ) // 获取相关行号
7 abstract public array getTrace ( void ) // 获取追踪信息,返回数组形式
8 abstract public string getTraceAsString ( void ) // 获取追踪信息,返回字符串形式
9 abstract public Throwable getPrevious ( void ) // 返回上一个 Throwable
10 abstract public string __toString ( void ) // 抛出的对象以字符串形式返回,比如可以用 echo 打印相应结果 11 }

猜你喜欢

转载自www.cnblogs.com/wengyingfeng/p/9319883.html