php 计算代码行数
2015-01-10 23:03
190 查看
<?php header("Content-type:text/html;charset=utf-8"); // php 递归计算文件夹代码行数 function codeLine($file){ return count(file($file)); } error_reporting(0); // 屏蔽notice 错误 $lines = 0; function forDir($path){ if(!is_dir($path)){ return null; } // $arr 数组里面放你要计算文件的后缀 $arr = array("php"); $dh = opendir($path); while(($dir = readdir($dh)) !== false){ if($dir != "." && $dir != ".."){ if(is_dir($path . "/" . $dir)){ $lines += forDir($path . "/" . $dir); }else{ foreach($arr as $v){ if(str_replace(".","",strrchr($dir,".")) == $v){ $lines += codeLine($path . "/" . $dir); } } } } } closedir($dh); return $lines; }
为了计算 Thinkphp 代码量而写的
相关文章推荐
- 用js实现计算代码行数的简单方法附代码
- php中根据某年第几天计算出日期年月日的代码
- php中计算中文字符串长度、截取中文字符串的函数代码
- php中计算未知长度的字符串哪个字符出现的次数最多的代码
- [php代码]返回受影响的行数
- 如何计算C++有效代码行数?
- 计算程序行数的shell代码
- 用PHP实现的四则运算表达式计算实现代码
- php 计算代码执行时间
- [原创]Python小工具 —— 计算 文件 或 文件夹及其所有子文件夹中所有文件 的 代码行数
- php 页面执行时间计算代码
- 用PowerShell来计算代码的大小和行数
- 计算一段日期内的周末天数的php代码(星期六,星期日总和)
- 用PHP实现的四则运算表达式计算实现代码
- php中根据某年第几天计算出日期年月日的代码
- 利用ip地址和子网掩码来计算该网段最多主机数的php代码
- 计算编写代码行数
- PHP统计目录下的文件总数及代码行数(去除注释及空行)
- 根据指定两个日期计算出这些时间内有多少天是周末 php程序函数代码
- 根据两点经纬度计算距离 附C#和PHP代码