array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'error.getfile.php', 1 => 'Error::getFile', ), 'up' => array ( 0 => 'class.error.php', 1 => 'Error', ), 'prev' => array ( 0 => 'error.getcode.php', 1 => 'Error::getCode', ), 'next' => array ( 0 => 'error.getline.php', 1 => 'Error::getLine', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'language/predefined/error/getfile.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
Error::getFile — エラーが起きたファイルを取得する
この関数にはパラメータはありません。
エラーが起きたファイル名を返します
例1 Error::getFile() の例
<?php
try {
throw new Error;
} catch(Error $e) {
echo $e->getFile();
}
?>
上の例の出力は、 たとえば以下のようになります。
/home/bjori/tmp/ex.php