Home >Backend Development >PHP Tutorial >How to use php is_file function?

How to use php is_file function?

青灯夜游
青灯夜游Original
2019-05-23 10:54:123266browse

php is_file() function is used to determine whether a given file is a regular file. The syntax is "is_file(file)". The parameter file is the file to be checked; if the file exists and is a regular file, then Returns TRUE, otherwise returns FALSE.

How to use php is_file function?

php is_file() function

is_file() function checks whether the specified file is a regular file.

Syntax:

is_file(file)

Parameters:

● file: required. Specifies the documents to be checked.

Return value: If the file exists and is a regular file, it returns TRUE, otherwise it returns FALSE.

Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.

php is_file() function usage example

<?php
var_dump(is_file(&#39;a_file.txt&#39;));
echo "<br>";
var_dump(is_file(&#39;/usr/bin/&#39;));
?>

Output:

bool(false)
bool(false)

The above is the detailed content of How to use php is_file function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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