php判断目录下的文件是否存在

WBOY
Release: 2016-06-13 13:40:27
Original
698 people have browsed it

求助php判断目录下的文件是否存在
刚刚接触php,求助大家怎么在php中判断某个目录下的文件是否存在?
这个我执行有错误。麻烦大家帮看看,先谢谢各位了。

$file = "../language/$yy.php";
if (is_file($file) == false) { 
  require("../language/$yy.php"); } 
else {
  require("../language/m.php"); }
 clearstatcache();


------解决方案--------------------

PHP code


 
$filename =   "../language/$yy.php";

if (file_exists($filename)) {
    //do some thing
} else {
   //do other thing
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template