<?
$d = dir(".");
echo "Handle: ".$d->handle."<br>\n";
echo "Path: ".$d->path."<br>\n";
while($entry=$d->read()) {
    echo $entry."<br>\n";
}
$d->close();
?>

解决方案 »

  1.   

    别人的。
    $FileCount = 0; //文件个数
    $DirectoryCount = 0; //目录个数
    function FCount($Path)
    {
    global $FileCount,$DirectoryCount;
        $Handle = opendir($Path);
        while($File = readdir($Handle))
        {
            if(filetype($Path.$File) != 'dir')
            {
                echo "----文件名----$File<br>";
                $FileCount++;
            }
            if($File !='.' && $File !='..' && filetype($Path.$File)=='dir')
            {
                echo "目录名----$File<br>";
                $DirectoryCount++;
                FCount($Path."$File/");
            }
        }
        closedir($Handle);
    }
    FCount('./upfiles/');
    echo "<br>请您注意脚本程序30秒钟超时警告<br><br>目录个数……………………$DirectoryCount<br>----文件个数……………………$FileCount<br>";
    ?>
      

  2.   

    //很简单.用面方法可以查看下 /etc/目录下的文件.(unix或linux,windows写法类似) $output =`ls -al /etc/`;
    echo "$output";
    //注: 反引号运算符在激活了 safe mode 或者关闭了 shell_exec() 时是无效的。