PHP file_exists() function
Definition and usage
file_exists() function checks files Or the directory exists. (Recommended learning: PHP programming from entry to proficiency)
Returns true if the specified file or directory exists, otherwise returns false.
Syntax
file_exists(path)
path, required. Specifies the path to be checked.
Example
$file = "check.txt"; if(file_exists($file)) { echo "当前目录中,文件".$file."存在"; } else { echo "当前目录中,文件".$file."不存在"; }
The above is the detailed content of PHP determines whether a file exists?. For more information, please follow other related articles on the PHP Chinese website!