RE: [PHP] Files question
From: Jay Blanchard (jay.blanchard_at_niicommunications.com)
Date: 10/30/03
- Next message: Manuel VáZquez Acosta: "Re: Files question"
- Previous message: Becoming Digital: "Re: [PHP] PHP & Apache 2"
- Maybe in reply to: Jay Blanchard: "RE: [PHP] Files question"
- Next in thread: Ray Hunter: "RE: [PHP] Files question"
- Reply: Ray Hunter: "RE: [PHP] Files question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 08:24:44 -0600 To: "Bas" <famde.jong@home.nl>, <php-general@lists.php.net>
[snip]
Now sorry... I already know to use fopen... I want a script that parses
all
lines from a file... Just like a loop that with every time it is
executed,
it echos a line from the file... (this is just a example... else i was
using
file_get_contents and nl2br...)
[/snip]
Well, Bas, the fopen and it's associated manual pages describe just how
to do this. Basic example
$theFile = fopen("myfile.foo", "r"); //open the file for reading
while(!feof($theFile)){ // while the file is not at the end of the file
$theLine = fgets($theFile, 1024); // get a line, specify a
length
echo $theLine; // print out the line you just got
} //close the while loop
- Next message: Manuel VáZquez Acosta: "Re: Files question"
- Previous message: Becoming Digital: "Re: [PHP] PHP & Apache 2"
- Maybe in reply to: Jay Blanchard: "RE: [PHP] Files question"
- Next in thread: Ray Hunter: "RE: [PHP] Files question"
- Reply: Ray Hunter: "RE: [PHP] Files question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|