PHP is_file () function
Definition and Usage
Are is_file () function checks the specified file is a regular file.
If the file is a regular file, the function returns TRUE.
grammar
is_file(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的文件。 |
Tips and Notes
Note: The results of this function are cached.Use clearstatcache () to clear the cache.
Examples
<?php
$file = "test.txt";
if(is_file($file))
{
echo ("$file is a regular file");
}
else
{
echo ("$file is not a regular file");
}
?>
$file = "test.txt";
if(is_file($file))
{
echo ("$file is a regular file");
}
else
{
echo ("$file is not a regular file");
}
?>
The code above will output:
test.txt is a regular file
Complete PHP Filesystem Reference Manual