while($file=readdir($handle)) {
if ( !eregi("(\.|cgi|php)$",$file) ) {
$file = 'asd/asd/$file'; // readdir读出的内容不含路径,而实际上是需要路径的
echo "<tr><td><a href='$file' target=\"_blank\">$file</a></td><td>".filesize($file)."</td></tr>\n";
}

解决方案 »

  1.   

    <?
    $newspath="asd/asd/";
    echo "<table border=0><tr><th width=120>文件名</th><th>大小(字节)</th></tr>";
    $hd=dir($newspath);
    while($filename=$hd->read())
    {
    if($filename=="."||$filename==".." ) continue;
    if(!eregi("(\.|cgi|php)$",$filename))
    {
    echo "<tr><td><a href='$newspath.$filename' target=\"_blank\">$filename</a></td><td>".filesize($newspath.$filename)."</td></tr>\n";
    }
    }
    ?>