复制代码 代码如下:
<?php
/**
* 計算該目錄下的程式規模,包含檔案數,行數,字數
*
* @version 1.0
* @since 1.0
* @access public
* @author Ryan <ryan@shinersoft.com>
* @copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @package AAPortal
*/
// 請修改這個目錄的位置
$dir = "aaportal";
// 以下不用更動
$counts = array("directory" => 0, "file" => 0, "line" => 0, "size" => 0);
check($dir);
echo "Total:\n";
echo "Directry : ".$counts["directory"]."\n";
echo "File : ".$counts["file"]."\n";
echo "Line : ".$counts["line"]."\n";
echo "Size : ".$counts["size"]."\n";
function check($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"]++;
//echo "dir ".$counts["directory"]." $path\n";
check($path);
} else {
$ext = array_pop(explode('.', basename($path)));
if ($ext=="php" || $ext=="inc") {
$counts["file"]++;
//echo "file ".$counts["file"]." $path\n";
$lines = file($path);
$counts["line"] += count($lines);
$counts["size"] += filesize($path);
}
}
}
closedir($dh);
}
} ?>
/**
* 計算該目錄下的程式規模,包含檔案數,行數,字數
*
* @version 1.0
* @since 1.0
* @access public
* @author Ryan <ryan@shinersoft.com>
* @copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @package AAPortal
*/
// 請修改這個目錄的位置
$dir = "aaportal";
// 以下不用更動
$counts = array("directory" => 0, "file" => 0, "line" => 0, "size" => 0);
check($dir);
echo "Total:\n";
echo "Directry : ".$counts["directory"]."\n";
echo "File : ".$counts["file"]."\n";
echo "Line : ".$counts["line"]."\n";
echo "Size : ".$counts["size"]."\n";
function check($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"]++;
//echo "dir ".$counts["directory"]." $path\n";
check($path);
} else {
$ext = array_pop(explode('.', basename($path)));
if ($ext=="php" || $ext=="inc") {
$counts["file"]++;
//echo "file ".$counts["file"]." $path\n";
$lines = file($path);
$counts["line"] += count($lines);
$counts["size"] += filesize($path);
}
}
}
closedir($dh);
}
} ?>
版权声明:
本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。