参数 | 描述 |
---|---|
file | 必需。规定要检查的文件。 |
如果文件存在且为正常的文件,则返回 true。
注释:本函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。
<?php $file = "test.txt"; if(is_file($file)) { echo ("$file is a regular file"); } else { echo ("$file is not a regular file"); } ?>
输出:
test.txt is a regular file
<?php var_dump(is_file(a_file.txt)) . "\n"; var_dump(is_file(/usr/bin/)) . "\n"; ?>
输出:
bool(true) bool(false)
制作:
http://www.7di.net 生活网搜集整理 参考: http://www.w3school.com.cn/php/func_filesystem_is_file.asp |