Home >php教程 >php手册 >区分大小写的文件存在判断

区分大小写的文件存在判断

WBOY
WBOYOriginal
2016-06-07 11:45:531347browse

PHP默认的file_exists和is_file在Windows下面是不区分大小写的,如果需要严格区分大小写的话,可以尝试使用下面的方法,该方法ThinkPHP已经内置。function file_exists_case($filename) {<br>     if (is_file($filename)) {<br>         if (strstr(PHP_OS, 'WIN')) {<br>             if (basename(realpath($filename)) != basename($filename))<br>                 return false;<br>         }<br>         return true;<br>     }<br>     return false;<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn