(PHP 5, PHP 7, PHP 8)
Exception::getLine — 获取创建异常的行号
此函数没有参数。
返回创建异常的行号。
示例 #1 Exception::getLine() 示例
<?php
try {
throw new Exception("Some error message");
} catch(Exception $e) {
echo "The exception was created on line: " . $e->getLine();
}
?>
上面的示例将输出类似以下内容
The exception was created on line: 3