PHP Exception getFile() 方法
示例
抛出异常并输出发生异常的文件路径
<?php
try {
throw new Exception("发生了一个错误");
} catch(Exception $e) {
echo "Error in this file: " . $e->getFile();
}
?>
自己动手试一试 »
定义和用法
getFile()
方法返回发生异常的文件的绝对路径。
语法
$exception->getFile()
技术详情
返回值 | 返回字符串 |
---|
相关页面
在我们的 PHP Exceptions 章节 中阅读更多关于 Exceptions 的信息。
❮ PHP Exception 参考