Home >Backend Development >PHP Tutorial >Detailed explanation of the use of file_exists function in php, phpfileexists_PHP tutorial

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:54:371094browse

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;>

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;>

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...
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