Home>Article>Backend Development> How to use php filetype function
php The filetype function is used to return the type of the specified file or directory. Its syntax is filetype(filename). If successful, the function returns one of 7 possible values; if it fails, it returns FALSE.
#How to use php filetype function?
Definition and usage
The filetype() function returns the type of the specified file or directory.
If successful, this function returns one of 7 possible values. On failure, returns FALSE.
Possible return values:
fifo char dir block link file unknown
Syntax
filetype(filename)
Parameters
filename required. Specifies the documents to be checked.
Tips and Notes
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
Example 1
The above code will output:
file
Example 2
The above code will output:
dir
The above is the detailed content of How to use php filetype function. For more information, please follow other related articles on the PHP Chinese website!