Return to Snippet

Revision: 77107
at August 22, 2019 20:50 by martinbrait


Initial Code
<?php

/*
Pour lire la première ligne de texte de votre fichier:
La fonction fgets() récupère les 4096 premiers caractères de la première ligne de votre fichier. 
*/

$file    = fopen( "fichier.txt", "r" );
$content = fgets($file, 4096);
fclose($file);
?>

Initial URL


Initial Description
read the first line of text of a file on the server

To read the first line of text in your file:
The fgets () function retrieves the first 4096 characters from the first line of your file.

Initial Title
[php] [txtfile] lire la première ligne de texte d'un fichier sur le serveur

Initial Tags
line

Initial Language
PHP