Throw an exception and display the file path where the exception occurred.
<?php try { throw new Exception(“An error occurred”); } catch(Exception $e) { echo “Error in this file: “ . $e->getFile(); } ?> |
The getFile() method returns the absolute path of the file where the exception was thrown.
$exception->getFile() |
Return Value: |
Returns a string value. |