getFile
返回拋出異常的文件的完整路徑。
getFile()
方法返回發生異常的文件的絕對路徑。
教程: PHP 異常
拋出一個異常,並輸出發生異常的文件的路徑:
<?php try { throw new Exception ( "An error occurred" ) ; } catch ( Exception $e ) { echo "Error in this file: " . $e -> getFile ( ) ; } ?>
親自試一試
$exception -> getFile ( )