PHP Exception getFile() 方法
定义和用法
getFile()
方法返回发生异常的文件的绝对路径。
相关页面
教程:PHP 异常
实例
抛出一个异常,并输出发生异常的文件的路径:
<?php
try {
throw new Exception("An error occurred");
} catch(Exception $e) {
echo "Error in this file: " . $e->getFile();
}
?>
语法
$exception->getFile()
技术细节
返回值: | 返回字符串。 |
---|