Error::getLine

(PHP 7, PHP 8)

Error::getLine獲取錯(cuò)誤發(fā)生時(shí)的行號(hào)

說明

final public Error::getLine(): int

獲取錯(cuò)誤發(fā)生時(shí)的行號(hào)。

參數(shù)

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

返回值

返回錯(cuò)誤發(fā)生時(shí)的行號(hào)。

范例

示例 #1 Error::getLine() 例子

<?php
try {
    throw new 
Error("Some error message");
} catch(
Error $e) {
    echo 
"The error was created on line: " $e->getLine();
}
?>

以上例程的輸出類似于:

The error was created on line: 3

參見