Home  >  Article  >  php教程  >  php file_exists 函数与 file_exists语法

php file_exists 函数与 file_exists语法

WBOY
WBOYOriginal
2016-06-08 17:27:221174browse

其实于php file_exists 函数与 file_exists语法我们早就讲过了,下面我们来看看一下关于它的使用方法与实例吧

<script>ec(2);</script>

bool file_exists ( string filename )

如果由 filename 指定的文件或目录存在则返回 TRUE,否则返回 FALSE

其实于php教程 file_exists 函数与 file_exists语法我们早就讲过了,下面我们来看看一下关于它的使用方法与实例吧

路径的文件或目录。

在Windows上,使用/ /计算机名/共享/文件名或 计算机名共享文件名,以检查网络共享文件。

这是一个很简单的实例一

$filename = '/www.111cn.net/aa/to/foo.txt';

if (file_exists($filename)) {
    echo "文件$filename exists";
} else {
    echo "文件$filename 不存在";
}
?>

输出结果为:

文件/www.111cn.net/aa/to/foo.txt己存在

再来看看实例二

echo file_exists("www.111cn.net.txt");
?>

这个我们就直接用file_exists来返回ture or 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