略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ErrorException::__construct

2024-05-15

ErrorException::__construct

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

ErrorException::__construct构造一个异常(Exception)

说明

public ErrorException::__construct(
    string $message = "",
    int $code = 0,
    int $severity = E_ERROR,
    ?string $filename = null,
    ?int $line = null,
    ?Throwable $previous = null
)

构造一个异常(Exception)。

参数

message

抛出的异常消息内容。

code

异常代码。

severity

异常的严重级别。

注意:

severity 可以是任意 int 值,即错误常量里面的值。

filename

抛出异常所在的文件名。

line

抛出异常所在的行号。

previous

异常链中的前一个异常。

更新日志

版本 说明
8.0.0 现在 filenameline 可以为空。 之前,它们的默认值分别是 __FILE____LINE__
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/errorexception.construct.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3