php简单浏览目录内容的实现代码

 更新时间:2013年06月07日 11:46:49   作者:  
本篇文章是对php简单浏览目录内容的实现代码进行了详细的分析介绍,需要的朋友参考下

如下所示:

复制代码 代码如下:

<?php
$dir = dirname(__FILE__);
$open_dir = opendir($dir);
echo "<table border=1 borderColor=red cellpadding=6>";
echo "<tr><th>文件名</th><th>大小</th><th>类型</th><th>修改日期</th></tr>";
while ($file = readdir($open_dir)) {
 if ($file!= "." && $file != "..") {
  echo "<tr><td>" . $file . "</td>";
  echo "<td>" . filesize($file) . "</td>";
  echo "<td>" . filetype($file) . "</td>";
  echo "<td>" . filemtime($file) . "</td></tr>";
 }

}
echo "</table>";
?>

相关文章

最新评论