gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

php中file_exists()函数使用详解

来源:http://erdangjiade.com/topic/1841.html 你好,世界。 2017-09-25 22:42浏览(13)

file_exists — 检查文件或目录是否存在

说明:
bool file_exists ( string $filename )

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

实例

实例一

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

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

实例二

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

直接用file_exists来返回ture or false。

以上就是php中file_exists()函数使用详解的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2