Example
Throw an exception and output the path of the file in which the exception occurred:
html
<?php
try {
throw new Exception("An error occurred");
}
catch(Exception $e) {
echo "Error in this file: " . $e->getFile();
}
?>
Definition and Usage
The getFile() method returns the absolute path to the file where an exception occurred.
Syntax
text
$exception->getFile()
Technical Details
| Return Value: | Returns a string |
|---|