$file = fopen("lola.txt","r") or exit("Cannot open the
file");
file");
echo fgets($file); // this pointer will advance one
// per line
To check wheter reach end of file, type:
feof($file);
To read a whole of file line by line, use:
while(!feof($file)){
echo fgets($file)."<br/>";
}To read a whole of file char by char, use:
while(!feof($file)){
echo fgetc($file)."<br/>";
}
No comments:
Post a Comment