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

巴扎黑
Release: 2016-11-24 13:47:14
Original
1444 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
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

Related labels:
php
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