php method to determine whether a directory is a file: 1. Use the "is_file()" function to determine whether it is a file, and the return result is true or false; 2. Use the "is_dir()" function to determine whether it is a directory , the return result is true or false.
php determines whether a file or a folder is mainly determined by the is_file and is_dir functions, which are explained below:
is_file() function
is_file() function is used to determine whether it is a file, and the return result is true or false
Example:
$ifile="c:/test"; $result=is_file($ifile); echo $result;
Output: false
is_dir() function
is_dir() function is used to determine whether it is a directory. The return result is true or false
Example:
$ifile="c:/test"; $result=is_file($ifile); echo $result;
Output: true
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to determine directory or file in php. For more information, please follow other related articles on the PHP Chinese website!