在唠叨老大的版面,我不合你一般见识。
贴出下面这段代码,纯粹是为了phper们借鉴之用,只为技术讨论。 $dh=opendir(AROOT."images/face");
while ($imagefile=readdir($dh)) {
if (($imagefile==".") || ($imagefile=="..") || ($imagefile=="")) continue;
$a++;
}
closedir($dh);
贴出下面这段代码,纯粹是为了phper们借鉴之用,只为技术讨论。 $dh=opendir(AROOT."images/face");
while ($imagefile=readdir($dh)) {
if (($imagefile==".") || ($imagefile=="..") || ($imagefile=="")) continue;
$a++;
}
closedir($dh);
//统计目录下文件总数
function countFile($dir)
{
$count = 0;
$handle = opendir($dir);
while (false!==($FolderOrFile = readdir($handle)))
{
if($FolderOrFile != "." && $FolderOrFile != "..")
{
$count++;
}
}
closedir($handle);
return $count;
}
//使用实例
print countFile("./Discuz25");
//输出: 35
?>另外, 也要考虑是不是目录的情况. 如果只是想统计文件, 不想统计目录的话