exception是所有异常的基类,类摘要如下:
<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>ErrorException是错误异常,类摘要如下:
<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>(全文完)
以上就介绍了预定义异常 - PHP手册笔记,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号