file_exists
(PHP 3, PHP 4, PHP 5)file_exists -- 检查文件或目录是否存在

解决方案 »

  1.   

    那么统计呢?
    用stat ("filename");吗?
      

  2.   

    统计 filename中含有的图片数目
      

  3.   

    $basedir = ""//路径
    $handle=opendir($basedir); 
    while ($file = readdir($handle)) {
    echo $file;
      //输出就行了
    }
      

  4.   

    $basedir = ""//路径
    $handle=opendir($basedir); 
    while ($file = readdir($handle)) {
        $arr[] = $file;
      //输出就行了
    }
    if (is_array($arr)) echo count($arr)
    else echo 0;
      

  5.   

    那么说$file不是所要的数目
    必须count($arr)?
    right?
      

  6.   

    #遍历目录,结果存入数组。支持php4及以上。php5以后可用scandir()函数代替while循环。
    function my_scandir($dir)
          {
           $files = array();
           if ( $handle = opendir($dir) ) {
           while ( ($file = readdir($handle)) !== false ) {
           if ( $file != ".." && $file != "." ) {
           if ( is_dir($dir . "/" . $file) ) {
           $files[$file] = rec_scandir($dir . "/" . $file);
           }else {
           $files[] = $file;
           }
           }
           }
           closedir($handle);
           return $files;
           }
          }
      

  7.   

    <?php
    $dir = "your file's path";
    if (is_dir($dir))
    {
        if ($dh = opendir($dir))
    {
            while (($file = readdir($dh)) !== false) 
    {
               $arr[] = $file;
            }
    echo "该文件夹下有".count($arr)."个文件";
            closedir($dh);
        }
    }else
    {
    mkdir($dir,0777);//建立文件夹
    }
    ?>