- var_dump(is_dir('a_file.txt')) . "\n";
- var_dump(is_dir('bogus_dir/abc')) . "\n";
- var_dump(is_dir('..')); //one dir up
- ?>
-
输出:
bool(false)
bool(false)
bool(true)
例2:
- $file = "images";
- if(is_dir($file))
- {
- echo ("$file is a directory");
- }
- else
- {
- echo ("$file is not a directory");
- }
- ?>
输出:
images is a directory |