php显示所有文件封装函数

来源:互联网 发布:js获取指定的时间戳 编辑:程序博客网 时间:2024/06/11 12:04


<?php
function showdir($path)
{
if (is_dir($path)){
  if ($dh = opendir($path)){
    while (($file = readdir($dh)) !== false){
if($file=="."||$file=="..")
{
continue;
}
$file=iconv("gb2312", "utf-8",$file);
echo "filename:" . $file . "<br>";
if(is_dir($path.'/'.$file))
      {
      showdir($path.'/'.$file);
      }
    }
    closedir($dh);
  }
}
}
showdir(".");

原创粉丝点击