Home > Backend Development > PHP Tutorial > The difference between is_file and file_exist in php_PHP tutorial

The difference between is_file and file_exist in php_PHP tutorial

WBOY
Release: 2016-07-13 17:45:52
Original
1025 people have browsed it

In PHP, there is a small difference between is_file and file_isexist
1) is_file:
$path ="/path/to/file/text.txt";
if(file_exists($path))
echo "File Exists";
else
echo "File not Exists";
For example, in this example, true will be returned if the file exists, false will be returned if it does not exist, but note that if a
is passed in The correct path (such as a file directory) will also return true:
$path ="/path/to/file";

2) file_isexist()
This will not happen. It is really to determine whether a file exists. If the above one is passed in, it looks like
The correct path also returns false

Author "jackyrong"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478623.htmlTechArticleIn PHP, there is a small difference between is_file and file_isexist 1) is_file: $path =/path/to /file/text.txt; if(file_exists($path)) echo File Exists; else echo File not Exists; For example, here...
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