(PHP 4, PHP 5, PHP 7)
file_exists — 锟斤拷锟斤拷募锟斤拷锟侥柯硷拷欠锟斤拷锟斤拷
$filename
) : bool锟斤拷锟斤拷募锟斤拷锟侥柯硷拷欠锟斤拷锟节★拷
filename
锟侥硷拷锟斤拷目录锟斤拷路锟斤拷锟斤拷
锟斤拷 Windows 锟斤拷要锟斤拷 //computername/share/filename 锟斤拷锟斤拷 \\computername\share\filename 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷械墓锟斤拷锟斤拷募锟斤拷锟�
锟斤拷锟斤拷锟� filename
指锟斤拷锟斤拷锟侥硷拷锟斤拷目录锟斤拷锟斤拷锟津返伙拷
TRUE
锟斤拷锟斤拷锟津返伙拷 FALSE
锟斤拷
Note:
This function will return
FALSE
for symlinks pointing to non-existing files.
锟斤拷锟斤拷锟轿�锟斤拷全模式锟斤拷锟斤拷锟狡讹拷锟斤拷锟铰诧拷锟杰凤拷锟斤拷锟侥硷拷锟侥伙拷锟斤拷锟矫猴拷锟斤拷锟结返锟斤拷
FALSE
锟斤拷然锟斤拷锟斤拷锟斤拷锟斤拷使锟斤拷
include 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷募锟斤拷锟�
safe_mode_include_dir
锟斤拷指锟斤拷锟斤拷目录锟斤。
Note:
The check is done using the real UID/GID instead of the effective one.
Note: 锟斤拷为 PHP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫凤拷锟斤拷锟斤拷锟酵讹拷锟揭很讹拷平台使锟斤拷 32 位锟斤拷锟酵o拷锟斤拷 2GB 锟斤拷锟较碉拷锟侥硷拷锟斤拷一些锟侥硷拷系统锟斤拷锟斤拷锟斤拷锟杰凤拷锟斤拷锟睫凤拷预锟节的斤拷锟� 锟斤拷
Example #1 锟斤拷锟斤拷一锟斤拷锟侥硷拷锟角凤拷锟斤拷锟�
<?php
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>
失锟斤拷时锟阶筹拷E_WARNING
锟斤拷锟芥。
Note: 锟剿猴拷锟斤拷锟侥斤拷锟斤拷岜伙拷锟斤拷妗o拷渭锟� clearstatcache() 锟皆伙拷酶锟斤拷锟较革拷凇锟�
锟斤拷 PHP 5.0.0 锟斤拷, 锟剿猴拷锟斤拷也锟斤拷锟斤拷某些 URL 锟斤拷装锟斤拷锟斤拷锟斤拷渭锟� 支锟街碉拷协锟斤拷头锟阶靶拷锟�锟皆伙拷锟街э拷锟� stat() 系锟叫猴拷锟斤拷锟斤拷锟杰的帮拷装锟斤拷锟叫憋拷