file_exists_ex
include_pathを考慮したfile_existsが流行っているようなので。
- http://blog.poyo.jp/archives.php/categ-1/year-2006/month-7/id-1152085878
- http://d.hatena.ne.jp/koyhoge/20060706/1152174594
function file_exists_ex($path) { $dirs = explode(PATH_SEPARATOR, get_include_path()); foreach ($dirs as $dir) { $abs_dir = realpath($dir); if ($abs_dir === false) { continue; } $abs_path = $abs_dir . DIRECTORY_SEPARATOR . $path; if (file_exists($abs_path)) { return true; } } return false; }