if(file_exists($cachefilename))
{
 echo "success";
}
else
{
 echo "failed";
}

解决方案 »

  1.   


    function getWholeDir($dir, $cdir, $n, &$dirlist)
    {
      if($cdir != "")
         $cdir = $dir . "/" . $cdir;
      else 
         $cdir = $dir;
      
      $handle=opendir($cdir);
      while ($file = readdir($handle))
      {
         if(is_dir($cdir  . "/" . $file) && $file != "." && $file != "..") 
         {
    $arrTemp[0] = $n;
    $arrTemp[1] = $cdir . "/" . $file;
    $dirlist[] = $arrTemp;
    $this->getWholeDir($cdir, $file, $n+1,  &$dirlist);
         }
      }
    }
      

  2.   

    $fp2 = @fopen($cachefilename,"w");
    if(!$fp)
    {
      echo "failed";
    }
      

  3.   


    这个几个变量 调用的时候 echo getWholeDir("html");
    Warning: Missing argument 2 for getWholeDir() in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 2Warning: Missing argument 3 for getWholeDir() in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 2Warning: Missing argument 4 for getWholeDir() in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 2Fatal error: Using $this when not in object context in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 17调用错误了吗
      

  4.   

    $arrDir = array();
    echo getWholeDir("html","",0,&arrDir); 
      

  5.   

    echo getWholeDir("html","",0,&arrDir);
    //这个提示
    //Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 24echo getWholeDir("html","",0,&$arrDir);
    //这样吗?也提示错误//Fatal error: Using $this when not in object context in D:\RUIOA\webroot\www-web\222.186.24.131\NewWeb\dir_1.php on line 17
    $this->getWholeDir($cdir, $file, $n+1,  &$dirlist);
    //17行就是这个
      

  6.   


    if($fp2 = @fopen($cachefilename,"w"))
    {
        //成功
    }else{
        //失败
    }