is_file,is_dir,file_exists

is_file()和file_exists()效率比较,结果当文件存在时,is_file函数比file_exists函数速度快14倍,当文件不存在时,两者速度相当。同理,当文件目录存在时,is_dir()比file_exists()快18倍。不存在时两者效率相当。PHP的file_exists = is_dir + is_file。
* 如果要判断目录是否存在,请优先考虑函数 is_dir(directory)
* 如果要判断文件是否存在,请优先考虑函数 is_file(filepath)

posted @ 2016-01-26 10:05  侠岚之弋痕夕  阅读(154)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!