以下为引用的内容: <?php function tree($directory) { echo date(”Y-m-d H:i:s”); $i=0; $mydir=dir($directory); echo “<ul>/n”; while($file=$mydir->read() AND $i<5) { if((is_dir(”$directory”)) AND ($file!=”.”) AND ($file!=”..”)) { $filetime=date(”Y-m-d H:i:s”,filectime($file)); //encode spaces $file = rawurlencode($file); // convert the + (this is one result from the function rawurlencode) in %20 $url = str_replace(’+’ , ‘%20′ , $file); echo “<li><font color=/”#ff00cc/”><a href=’”.$url.”‘>”.$url.”</a></font> $filetime<br/></li>/n”; $i+=1; } } echo “</ul>/n”; $mydir->close(); } tree(”.”); // 列出当前目录 ?> |