English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Reference Manual
The is_file() function can check if the specified file is a normal file.
bool is_file ( string $filename )
This function can return true if the filename exists and is a normal file, otherwise it returns false.
<?php $file = "/PhpProject/php/phptest.txt"; if(is_file($file)) { echo("$file is a normal file"); } else { echo("$file is not a normal file"); } ?>
Output Result
/PhpProject/php/phptest.txt is a normal file
<?php var_dump(is_file("/PhpProject/simple.txt")) . "\n"; var_dump(is_file("/PhpProject/php")) . "\n"; ?>
Output Result
bool(false) bool(false)