Detailed explanation of the use of file_exists function in php, phpfileexists_PHP tutorial

WBOY
Release: 2016-07-13 09:54:37
Original
1066 people have browsed it

Detailed explanation of the use of file_exists function in php, phpfileexists

Explanation:
bool file_exists ( string $filename )

Returns TRUE if the file or directory specified by filename exists, otherwise returns FALSE.

On Windows, use //computername/share/filename or computernamesharefilename to check for network shared files.

In Windows, use //computername/share/filename or \computernamesharefilename to check shared files on the network.

Example 1

<&#63;php
$filename = '/jb51.net/aa/to/foo.txt';
if (file_exists($filename)) {
echo "文件$filename exists";
} else {
echo "文件$filename 不存在";
}
&#63;>
Copy after login

The output result is:
The file /jb51.net/aa/to/foo.txt already exists

Example 2

<&#63;php
echo file_exists("jb51.net.txt");
&#63;>
Copy after login

Use file_exists directly to return true or false.

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/996225.htmlTechArticleDetailed explanation of the use of file_exists function in php, phpfileexists description: bool file_exists (string $filename) If the file specified by filename or Returns TRUE if the directory exists, otherwise returns F...
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