index.php
以下のコードと(同じディレクトリ内の)別のファイルを含む2つのファイルで構成されるPHPプロジェクトを作成しますexample.png
。
echo file_exists('example.png')
? 'outside the handler - exists'
: 'outside the handler - does not exist';
register_shutdown_function('handle_shutdown');
function handle_shutdown()
{
echo file_exists('example.png')
? 'inside the handler - exists'
: 'inside the handler - does not exist';
}
foo();
を実行しますindex.php
。
取得できるものは次のとおりです。
outside the handler - exists
Fatal error: Call to undefined function foo() in /path/to/project/index.php on line 16
inside the handler - does not exist
これが私の質問です。
内部file_exists
(ハンドラー内のもの)がファイルを見つけられないのはなぜですか?