ErrorException::getSeverity

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

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

说明

finalpublicErrorException::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)
To Top