« Exception::getCode
Exception::getLine »

Exception::getFile

(PHP 5, PHP 7, PHP 8)

Exception::getFile — 例外が作られたファイルを取得する

説明

final public function Exception::getFile(): string

例外が作られたファイルの名前を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

例外が作られたファイルの名前を返します。

例

例1 Exception::getFile() の例

<?php
try {
    throw new Exception;
} catch(Exception $e) {
    echo $e->getFile();
}
?>

上の例の出力は、 たとえば以下のようになります。

/home/bjori/tmp/ex.php

参考

関連キーワード:
Exception   getFile   getCode   getLine   final   throw   catch   home   bjori   参考   Throwable
関連する関数・ページ:
error.getfile   exception.getcode   throwable.getfile   exception.getline   class.zmqexception   class.yaf-exception