PHP Exception getFile() 方法
示例
丟擲異常並輸出發生異常的檔案路徑
<?php
try {
throw new Exception("發生了一個錯誤");
} catch(Exception $e) {
echo "Error in this file: " . $e->getFile();
}
?>
自己動手試一試 »
定義和用法
getFile()
方法返回發生異常的檔案的絕對路徑。
語法
$exception->getFile()
技術詳情
返回值 | 返回字串 |
---|
相關頁面
在我們的 PHP Exceptions 章節 中閱讀更多關於 Exceptions 的資訊。
❮ PHP Exception 參考