visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: how to read a text file and echo its contents in PHP ?


By: Nono Great Britain  Date: 24/03/2008 10:14:55  English  Points: 20 Status: Answered
Quality : Excellent
how to read a text file and echo its contents in PHP ?
By: VGR Date: 24/03/2008 10:28:09 English  Type : Answer
hello,

this is very easy. You've a

readfile()

function available in PHP. It outputs the contents (unless you

ob_start()

beforehand, of course).

To get the file, row by row [on CRLF], in an array, you've the

file()

function

and to get is as a loooong string in a single variable, you've the function

file_get_contents()



and of course, finally, to read it row by row, you would use the standard C functions

fopen(), fgets() and fclose()



that's all ;-)

I only RTFM :D
By: sweet_aris08 Date: 06/07/2009 15:17:00 English  Type : Comment
file_get_contents()

Do register to be able to answer

EContact
browser fav
page generated in 107.183930 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page