zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

PHP代码 实现 简单 目录 内容 浏览
2023-06-13 09:15:01 时间

如下所示:

复制代码代码如下:

<?php
$dir=dirname(__FILE__);
$open_dir=opendir($dir);
echo"<tableborder=1borderColor=redcellpadding=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>";
?>