Home >Backend Development >PHP Tutorial >How to get the number of lines in a file in PHP_PHP Tutorial
provides two implementation methods. Although the second one is simple and easy to understand, the first one is the most efficient
First type:
3 4
5
8 9
|
$file_path = 'xxx.txt'; //File path |
1 2 3 4 | <🎜>$line = count(file('filename'));<🎜> <🎜>echo $line;<🎜> <🎜>?> |