PHP file_exists()Function


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The file_exists() function checks whether a file or directory exists.

Returns TRUE if the specified file or directory exists, otherwise returns FALSE.

Syntax

file_exists(path)

Parameter Description
path Required. Specifies the path to check.


Example

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

The above code will output:

1


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions