ErrorException::getSeverity

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

ErrorException::getSeverity獲取異常的嚴(yán)重程度

說明

final public ErrorException::getSeverity(): int

返回異常的嚴(yán)重程度。

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

返回異常的嚴(yán)重級(jí)別。

范例

示例 #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)