在线文档教程
PHP
类和函数 | Classes and Functions

Throwable

Throwable

Introduction

(PHP 7)

Throwable is the base interface for any object that can be thrown via a throw statement in PHP 7, including Error and Exception.

Note: PHP classes cannot implement the Throwable interface directly, and must instead extend Exception.

Interface synopsis

Throwable {

/* Methods */

abstract public string getMessage ( void )

abstract public int getCode ( void )

abstract public string getFile ( void )

abstract public int getLine ( void )

abstract public array getTrace ( void )

abstract public string getTraceAsString ( void )

abstract public Throwable getPrevious ( void )

abstract public string __toString ( void )

}

Table of Contents

  • Throwable::getMessage — Gets the message

  • Throwable::getCode — Gets the exception code

  • Throwable::getFile — Gets the file in which the exception was created

  • Throwable::getLine — Gets the line on which the object was instantiated

  • Throwable::getTrace — Gets the stack trace

  • Throwable::getTraceAsString — Gets the stack trace as a string

  • Throwable::getPrevious — Returns the previous Throwable

  • Throwable::__toString — Gets a string representation of the thrown object

← IteratorAggregate::getIterator

Throwable::getMessage →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/class.throwable.php