The filetype() function returns the type of the specified file or directory.
If successful, the function returns one of 7 possible values. If it fails, returns FALSE.
Possible return values:
fifo
char
dir
block
link
file
unknown
filetype(filename)
parameter | describe |
---|---|
filename | Required. Specifies the documents to be checked. |
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
<?phpecho filetype("test.txt");?>
The above code will output:
file
<?phpecho filetype("images");?>
The above code will output:
dir