Exception::getFile
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Gets the file in which the exception was created
Description
Exception::getFile(): string
Get the name of the file in which the exception was created.
Parameters Parameters
Return Values
Returns the filename in which the exception was created.
Examples
Exception::getFile() example
php
<?php
try {
throw new Exception;
} catch(Exception $e) {
echo $e->getFile();
}
?>The above example will output something similar to:
output
/home/bjori/tmp/ex.phpSee Also
Throwable::getFile