is_file 与 file_exists 的区别

file_exists :是判断文件是否存在 或目录是否存在。

is_file : 判断文件是否存在。

is_dir :判断目录是否存在。

 

file_exists = is_file + is_dir(两都的功能)

如果只是判断其中的一种情况,最好是独立使用 is_file 和is_dir

从执行性能来看,如果两都被缓存。is_file 比 file_exists 性能高。

所有在实际开发中,根据情况而定。

posted @ 2017-03-14 10:52  ycookiee  阅读(249)  评论(0编辑  收藏  举报