计算Excel文件中的行数

时间:2013-01-08 22:22:48

标签: php wordpress excel count

  

可能重复:
  Efficiently counting the number of lines of a text file. (200mb+)
  How do I determine the end of the file using PHPExcel library in chunk loop?

我似乎无法在PHP中使用它

我正在尝试计算上传的EXcel文件中的行数

这是我所拥有的,但它总是将它乘以2我想删除第一行,因为它只是标题,请帮助:

$countthelines= count(file($file)) -1;

1 个答案:

答案 0 :(得分:1)

将您的Excel文件转换为CSV文件并尝试以下操作:

$countthelines = count(file($file, FILE_SKIP_EMPTY_LINES)) - 1;