ErrorException::getSeverity

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

ErrorException::getSeverity获取异常的严重程度

说明

final public ErrorException::getSeverity(): int

返回异常的严重程度。

参数

此函数没有参数。

返回值

返回异常的严重级别。

范例

示例 #1 ErrorException::getSeverity() 例子

<?php
try {
throw new
ErrorException("Exception message", 0, E_USER_ERROR);
} catch(
ErrorException $e) {
echo
"This exception severity is: " . $e->getSeverity();
var_dump($e->getSeverity() === E_USER_ERROR);
}
?>

以上例程的输出类似于:

This exception severity is: 256
bool(true)

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top