Search for file and view content

2

I need to get a arquivo.txt , print it on the screen and enter the total number of lines, but I would like to "search" the file in any system directory

<?php

$arquivo = fopen('arquivo.txt', 'r');

while (!feof ($arquivo)) {
  $linha = fgets($arquivo);
  echo $linha."<br>";
}
fclose ($arquivo);

$linhas = count( file('arquivo.txt' ) );

echo "<br />Quantidade de linhas : ".$linhas;

?>
    
asked by anonymous 16.05.2017 / 02:47

1 answer

2

To search for all files named arquivo.txt in any sub-directory from the root of the application, you can use the

16.05.2017 / 03:49