首頁  >  文章  >  後端開發  >  php判断目录下的文件是否存在

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

WBOY
WBOY原創
2016-06-13 13:40:27667瀏覽

求助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>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn