php 操作目录

来源:互联网 发布:淘宝运营课程表及费用 编辑:程序博客网 时间:2024/06/06 19:37
$arr = scandir($dir); 
$all = count($arr)-2;//所有文件总数除./和../
$php = count(preg_grep("/\.php$/", $arr));
$txt0 = $all - count(preg_grep("/\.txt$/", $arr));
echo '共有'.$all.'个文件,php文件'.$php.'个,非txt文件'.$txt0.'个';
原创粉丝点击