欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

?算你?_?l的 PHP 程式大小

时间:2021-05-20 09:29:35|栏目:PHP代码|点击:

复制代码 代码如下:
<?php   

/**   
* ?算?目?下的程式?模,包含?n案?担?行?担?字??   
*   
* @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);   
    }   
} ?> 

上一篇:ThinkPHP3.1新特性之多层MVC的支持

栏    目:PHP代码

下一篇:php实现递归抓取网页类实例

本文标题:?算你?_?l的 PHP 程式大小

本文地址:http://www.codeinn.net/misctech/125225.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有