标签:fclose ret read turn function pre filename UNC 文件的
// 获取文件行数
function lines($fileName)
{
$fp = fopen($fileName, "r");
$line = 0;
while (!feof($fp)) {
//每次读取1M
if ($data = fread($fp, 1024 * 1024 * 1)) {
//计算读取到的行数
$num = substr_count($data, "\n");
$line += $num;
}
}
fclose($fp);
return $line;
}
标签:fclose ret read turn function pre filename UNC 文件的
原文地址:https://www.cnblogs.com/phonecom/p/10986464.html