?呾斕嶱追腔 PHP 最宒湮苤
2018-09-07 14:52
葩秶測鎢 測鎢狟:<?php
/**
*?呾?醴?狟腔最宒?耀ㄛ婦漪偶ㄛ俴ㄛ趼
*
*@version1.0
*@since1.0
*@accesspublic
*@copyrightCopyright(c)2002-2004byShinerTechnologiesCo.,Ltd.
*@packageAAPortal
*/
//?党蜊稛?醴?腔弇离
$dir=aaportal;
//眕狟祥蚚載
$counts=array(directory=>0,file=>0,line=>0,size=>0);
check($dir);
echoTotal:\n;
echoDirectry:.$counts[directory].\n;
echoFile:.$counts[file].\n;
echoLine:.$counts[line].\n;
echoSize:.$counts[size].\n;
functioncheck($dir)
{
global$counts;
if($dh=opendir($dir)){
while(($file=readdir($dh))!==false){
if($file==.)continue;
if($file==..)continue;
if($file==CVS)continue;
$path=$dir./.$file;
if(is_dir($path)){
$counts[directory]++;
//echodir.$counts[directory].$path\n;
check($path);
}else{
$ext=array_pop(explode(.,basename($path)));
if($ext==php$ext==inc){
$counts[file]++;
//echofile.$counts[file].$path\n;
$lines=file($path);
$counts[line]+=count($lines);
$counts[size]+=filesize($path);
}
}
}
closedir($dh);
}
}?>