PHP is_dir() 函数
PHP is_dir() 函数 定义和用法 is_dir() 函数检查指定的文件是否是一个目录。 如果目录存在,该函数返回 TRUE。 语法 is_dir(file) 参数 描述 file 必需。规定要检查的文件。 提示和注释 注释: 该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。 实例 <?php $file = "images"; if(is_dir($file)) { echo ("$file is a directory"); } else { echo ("$file is not a directory"); } ?> 上面的代码将输出: images is a directory
PHP is_dir() 函数
定义和用法
is_dir() 函数检查指定的文件是否是一个目录。
如果目录存在,该函数返回 TRUE。
语法
is_dir(file)
| 参数 | 描述 |
|---|---|
| file | 必需。规定要检查的文件。 |
提示和注释
注释: 该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。
实例
<?php $file = "images"; if(is_dir($file)) { echo ("$file is a directory"); } else { echo ("$file is not a directory"); } ?>
上面的代码将输出:
images is a directory
交流与评论