php is_file 判断文件存在
我们利用了file_exists和is_file函数来判断是否为文件和文件是否存在,这里我们对路径说了一下特别说明,有需要的朋友可以参考一下,用户判断文章是否存 is_file file_exists函数实现,代码如下:
- function isFile($path)
- {
- if( file_exists($path) && is_file($path))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
注意is_file 与 file_exists函数不能判断绝对路径如我上面的$_path ='/upfile/'就会显示找不到文件,如果用../upfile/就OK了.