手机
当前位置:查字典教程网 >编程开发 >php教程 >php中file_exists函数使用详解
php中file_exists函数使用详解
摘要:说明:boolfile_exists(string$filename)如果由filename指定的文件或目录存在则返回TRUE,否则返回FA...

说明:

bool file_exists ( string $filename )

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

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

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

实例一

<?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。

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

【php中file_exists函数使用详解】相关文章:

php分页函数

PHP中的traits简单使用实例

PHP中的事务使用实例

在php中使用sockets:从新闻组中获取文章

php中file_exists函数使用详解

php中smarty区域循环的方法

php三元运算符知识汇总

php.ini中文版

php中PDO方式实现数据库的增删改查

php中关于socket的系列函数总结

精品推荐
分类导航