Hello, I am generating the reading of a txt file which has a structure like the following
Cabecera
122121215656565
686846846846846
489498498498498
19894984949444
PiePagina
I am interested in recovering line 2122121215656565
I have tried the following:
//Abriendo el archivo
$arc = fopen('archivos/' . $nombre, "r");
//Obteniendo una linea completa del archivo txt
$linea = fgets($arc);
//Cerrando el archivo
fclose($arc);
With this code it returns me Cabecera
, how could I tell PHP to only retrieve line 2, thank you very much in advance and I hope I have been clear
Well, a solution could be to iterate until you reach the section of the file that you require.
Cheers...
With the file function, you can access the content of the file as if it were an array (each line will be an element of the array):