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

The difference between is_file and file_exist in php

巴扎黑
巴扎黑Original
2016-11-24 13:47:141446browse

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
correct path (such as a file directory) is passed in, It will also return true:
$path ="/path/to/file";

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

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
Previous article:php variable scopeNext article:php variable scope