PHP is_dir () function usage Guide, Is_dir usage guide
Function: Is_dir ()
Function: Determine if a given file name is a directory
Description
BOOL Is_dir (String $filename)
Returns TRUE if the file name exists and is a directory.
If filename is a relative path, the relative path is checked according to the current working directory.
Note: The result of this function is cached. See Clearstatcache () for more information.
Example 1
<?var_dump (Is_dir (' A_file.txt ')). "\ n"; Var_dump (Is_dir (' bogus_dir/abc ')). "\ n"; Var_dump (Is_dir ('. ')); One dir up?>
The example above will output:
BOOL (FALSE)
BOOL (FALSE)
BOOL (TRUE)
Example 2
<?php$file = "Images", if (Is_dir ($file)) {echo ("$file is a Directory");} Else{echo ("$file is not a directory"); >
Output:
If the directory exists images, the output is:
Images is a directory
The above mentioned is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/996224.html www.bkjia.com true http://www.bkjia.com/PHPjc/996224.html techarticle php is_dir () function usage Guide, Is_dir usage guide function: Is_dir () function: Determine whether a given file name is a directory description: bool Is_dir (string $filename) if the file name ...