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