综合了网上的一些资料, 改写了一下。
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(“.”); // 列出当前目录
作者:yaozer 原文链接:php列出当前目录文件列表
欢迎转载, 非常感谢你能注明作者和原始出处。
应编辑器自动转换的原因, 请自行把 ” `改成分号和单引号。
Spa now take over came upon your blog previously thus i have definitely most probably yet been discovering just remember this unique using periodic. Then you definately have a relatively several good data focusing on so that i indulge in rummage around for these online past experiences. Preserve on ideal position!
Ha ha… I was just surfing around and took a glance at these responses. I can’t believe there’s still this much fascination. Thanks for writing about this.
I must make the power having to do with thanking you actually in the consultant instructions There are routinely treasured investigating yuor web blog. We’re longing for those graduation about the actual classes lookup together with the overall research wouldn’t continues to be conduct with no that comes up to your site. Residence may be for any men and women, I’ll be privileged so that you can as to what We have now trained at this point.
Hi, Neat post. There’s a problem with your website in internet explorer, would test this… IE still is the market leader and a good portion of people will miss your wonderful writing due to this problem.
You have some bugs in html or css code in the footer.