区分大小写的文件存在判断file_exists_case函数有问题

浏览:564 发布日期:2015/09/17 分类:求助交流
BUG:区分大小写的文件存在判断file_exists_case函数有问题,它只能区分文件名的大小写判断,并不能区分目录;

解决方法:加两行区分目录的判断即可。function file_exists_case($filename) {
    if (is_file($filename)) {
        if (IS_WIN && APP_DEBUG) {
                
             // 分区目录大小写的判断
            if (str_replace('\\', '/', realpath($filename)) != str_replace('\\', '/', $filename))
                return false;
             
           // 原只判断文件名的大小写
            if (basename(realpath($filename)) != basename($filename))
                return false;
        }
        return true;
    }
    return false;
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>