Echoing a text document

Hey,
I need to know how to grab a text document and display the text inisde it.

Thanks

[php]
$file = “./users.txt”;
$fp = fopen("$file", “a+”);
while (!feof($fp)) $content .= fgetc($fp);
$content = $content;
fclose($fp);
[/php]

$contents would be your result variable.

even more basic than that you could do :

[php]
echo “

”;
include (‘path/to/document.txt’);
echo “
”;
[/php]

If there is no need to parse any of the text document then you can just include the entire document. I used the PRE tags which will present the text document as it was originally.

Good luck

Sponsor our Newsletter | Privacy Policy | Terms of Service