(PHP 7, PHP 8)
Error::getLine — 获取发生错误的行号
此函数没有参数。
返回发生错误的行号。
示例 #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