php提供了许多操作文件的函数,比如 dir() 可以读取 目录中的全部文件等  下面我给出程序:
   $path="c:/php4";  //设置要读出的目录的路径
   $allfile=dir($path); 
   echo "当前的了路径".$allfile->path."<br>";
   echo "当前的了路径下有的文件如下";
  while($item=$allfile->read()) {
   echo $item;
echo "<br>";}
  $allfile->close();
 上面的应该能够满足你的需要了, 当然 dir()还有其他属性,请参考其它资料

解决方案 »

  1.   

    dir
    目录类别物件。语法: new dir(string directory);传回值: 物件函式种类: 档案存取
     
     
    内容说明 
    这是一个类似物件导向的类别物件,用来读取目录。当目录参数 directory 开启之后,有二个属性可用:handle 属性就像其它非物件的函式所用的 readdir()、rewinddir() 及 closedir();path 属性则设定开启目录后的路径参数。本物件有三个方法 (method):read、rewind 与 close。
     
     
    使用范例 
    <?
    $d = dir("/etc");
    echo "Handle: ".$d->handle."<br>\n";
    echo "Path: ".$d->path."<br>\n";
    while($entry=$d->read()) {
        echo $entry."<br>\n";
    }
    $d->close();
    ?> 
      

  2.   

    <?php 
    /*一个简单的目录递归函数。 */ 
    function tree($directory) 

    $mydir=dir($directory); 
    echo "<ul>\n"; 
    while($file=$mydir->read()){ 
    if((is_dir("$directory/$file")) AND ($file!=".") AND ($file!="..")) 
    {echo "<li><font color=\"#ff00cc\"><b>$file</b></font></li>\n"; 
    tree("$directory/$file"); 

    else 
    echo "<li>$file</li>\n"; 

    echo "</ul>\n"; 
    $mydir->close(); 

    //start the program 
    echo "<h2>目录为粉红色</h2><br>\n"; 
    tree("."); 
    ?>