Latest web development tutorials

PHP file_exists () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

file_exists () function checks the file or directory exists.

If the specified file or directory exists returns TRUE, otherwise it returns FALSE.

grammar

file_exists(path)

参数 描述
path 必需。规定要检查的路径。


Examples

<?php
echo file_exists("test.txt");
?>

The code above will output:

1


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual