Home > Backend Development > PHP Tutorial > Predefined exceptions - PHP manual notes

Predefined exceptions - PHP manual notes

WBOY
Release: 2016-08-08 09:28:43
Original
1029 people have browsed it

Exception is the base class for all exceptions. The class summary is as follows:

<code><?php 
class 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)
}</code>
Copy after login

ErrorException is an error exception, the class summary is as follows:

<code><?php 
class ErrorException extends Exception {
	protected int $severity;  // 异常级别

	public __construct([string $message = "" [, int $code = 0 [, int $severity = 1 [, string $filename = __FILE__ [, int $lineno = __LINE__ [, Exception $previous = NULL]]]]]])
	final public int getSeverity(void)
}</code>
Copy after login

(Full text ends)

The above introduces the predefined exceptions - PHP manual notes, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template