「php入門」ディレクトリ内のファイル数をカウントするサンプルコード

phpコード:
function FileCountFunc($url)
{
$sl = 0;
$arr = glob($url);
foreach($arr as $v)
{
if(is_file($v))
{
$sl++;
}
else
{
$sl += FileCountFunc($v."/*");
}
}
return $sl;
}

echo FileCountFunc(“./ajax/*");

PHP

Posted by arkgame