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"0E_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)