基本信息
源码名称:关于php的遍历目录
源码大小:1.03KB
文件格式:.php
开发语言:PHP
更新时间:2021-12-23
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
php中的遍历目录

<?php
echo"<style>";
echo"table{width:700px;margin:0 auto;}";
echo"table th{background:#0066ff;color:#ffffff;line-height:25px}";
echo"table td{background:#eee;color:#000;line-height:25px}";
echo"< yle>";
function findDir($dirName){
$num=0;
$dir_handle=opendir($dirName);
echo&apos;<table>&apos;;
echo&apos;<caption><h2>目录&apos;.$dirName.&apos;下的文件</h2></caption>&apos;;
echo&apos;<tr>&apos;;
echo&apos;<th>文件名</th><th>文件大小</th><th>文件类型</th><th>修改时间</th></tr>&apos;;
while($file=readdir($dir_handle)){
$dirFile=$dirName.&apos;/&apos;.$file;
$num ;
echo&apos;<tr>&apos;;
echo&apos;<td>&apos;.$file.&apos;</td>&apos;;
echo&apos;<td>&apos;.filesize($dirFile).&apos;</td>&apos;;
echo&apos;<td>&apos;.filetype($dirFile).&apos;</td>&apos;;
echo&apos;<td>&apos;.date(&apos;Y/n/t&apos;,filemtime($dirFile)).&apos;</td>&apos;;
echo&apos;</tr>&apos;;
}
echo"<tr><th colspan=&apos;4&apos;>在 $dirName 目录下共有 $num 个子文件;
</th></tr>";
echo"</table>";
closedir($dir_handle);
}
findDir(&apos;../file&apos;);
?>