首页 > php代码 > php file_exists 函数与 file_exists语法

php file_exists 函数与 file_exists语法

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

bool file_exists ( string filename )

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

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

路径的文件或目录。

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

这是一个很简单的实例一

<?php
$filename = '/www.phprm.com/aa/to/foo.txt';

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

输出结果为:

文件/www.phprm.com/aa/to/foo.txt己存在

再来看看实例二

<?php
echo file_exists("www.phprm.com.txt");
?>

这个我们就直接用file_exists来返回ture or false

 

文章地址:http://www.phprm.com/code/file_exists.html

转载随意^^请带上本文地址!

标签:none

发表留言