Throw an exception and output the path of the file in which the exception occurred:
<?php
try {
throw new Exception("An error occurred");
} catch(Exception $e) {
echo "Error in this file: " . $e->getFile();
}
?>
Try it Yourself »
The getFile()
method returns the absolute path to the file where an exception occurred.
$exception->getFile()
Return Value: | Returns a string |
---|
Read more about Exceptions in our PHP Exceptions Chapter.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!