[K12OSN] PHP and include?

Petre Scheie petre at maltzen.net
Wed Oct 11 14:02:12 UTC 2006



george kocke wrote:
> Doug Simpson wrote:
> 
>> If I am thinking correctly, there is an include function on php that 
>> will do this, but I need the syntax. Also, if possible, I need it to 
>> pull the txt file from the users' public_html folder.
> 
> $text = file_get_contents($filename);
> 
file_get_contents() returns a single variable, whereas file() returns an array with each 
element corresponding a line of the file:

$text = file($filename);
foreach ($text) {
   // do something with the line of text
}

Petre







More information about the K12OSN mailing list