蟋蟀
版主
  
村里巡逻队长
UID 67242
精华
0
积分 2035
帖子 1762
金钱 2035 喜悦币
威望 0
人脉 0
阅读权限 100
注册 2005-12-17 来自 福建
状态 离线
|
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
<?php
/** 函数 file_count
* 参数 string $dir 目录
* 返回 integer $count 文件个数
* 描述 提取目录下的文件个数
*/
function file_count($dir="")
{
$count=0;
$dir=isset($dir) && !empty($dir)?$dir:dirname(__FILE__);
$h_dp=opendir($dir);
while(false!=($f_dir=readdir($h_dp)))
{
if(is_file($f_dir))
{
$count++;
}
}
return $count;
}
print file_count();
?>
其实可以直接scandir 返回数组文件 目录数组,只是不太准确
|  吉林php群
27089230 |
|