php中file_exists函数使用详解 php中file_exists函数使用详解

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

php中file_exists函数使用详解 php中file_exists函数使用详解

  2021-03-21 我要评论
想了解php中file_exists函数使用详解的相关内容吗,在本文为您仔细讲解php中file_exists函数使用详解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:php,file_exists函数,下面大家一起来学习吧。

说明:
bool file_exists ( string $filename )

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

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

在 Windows 中要用 //computername/share/filename 或者 \\computername\share\filename 来检查网络中的共享文件。

实例一

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

输出结果为:
文件/jb51.net/aa/to/foo.txt己存在

实例二

<?php
echo file_exists("jb51.net.txt");
?>

直接用file_exists来返回ture or false。

以上所述就是本文的全部内容了,希望大家能够喜欢。

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们