Definition :
The getFile()
method is used to returns the absolute path to the file where an exception occurred.
$exception->getFile()
Parameters
No parameter is required.
Given below example
Throw an exception and output the path of the file in which the exception occurred:
Output : Error in this file: C:\xampp\htdocs\php\php Exception\getfile().php