Home > Backend Development > PHP Problem > How to use php filetype function

How to use php filetype function

藏色散人
Release: 2023-02-22 19:58:02
Original
3460 people have browsed it

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

#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
Copy after login

Syntax

filetype(filename)
Copy after login

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

<?php
echo filetype("test.txt");
?>
Copy after login

The above code will output:

file
Copy after login

Example 2

<?php
echo filetype("images");
?>
Copy after login

The above code will output:

dir
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template