PHP的Exception

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fujian9544/article/details/89598496

Exception是所有异常的基类。

Exception {

/* 属性 */

protected string $message;

protected int $code;

protected string $file;

protected int $line;

/* 方法 */

public __construct([ string $message = ""[, int $code = 0[, Exception $previous = NULL]]]
 )

    final public string getMessage( void)

    final public Exception getPrevious( void)

    final public int getCode( void)

    final public string getFile( void)

    final public int getLine( void)

    final public array getTrace( void)

    final public string getTraceAsString( void)

    public string __toString( void)

    final private void __clone( void)
}
•Exception::__construct — 异常构造函数
•Exception::getMessage — 获取异常消息内容
•Exception::getPrevious — 返回异常链中的前一个异常
•Exception::getCode — 获取异常代码
•Exception::getFile — 获取发生异常的程序文件名称
•Exception::getLine — 获取发生异常的代码在文件中的行号
•Exception::getTrace — 获取异常追踪信息
•Exception::getTraceAsString — 获取字符串类型的异常追踪信息
•Exception::__toString — 将异常对象转换为字符串
•Exception::__clone — 异常克隆

猜你喜欢

转载自blog.csdn.net/fujian9544/article/details/89598496