Reading a php file and outputting contents

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Reading a php file and outputting contents

Post by like_duh44 »

I'm trying to output the contents of a php file. I have the file users.php with a whole bunch of stuff in it. I have this code to get the contents of the file, but it doesnt show anything. Any ideas?

Code: Select all

<?php

$filename = "users.php";
$handle = fopen ($filename, "r");
$content = fread ($handle, filesize ($filename));
fclose ($handle);

echo $content;


?>
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

explaining what jason said, u have to use the function: highlight_file();
example:
highlight_file('myfile.php',true); //the last value means NOT to print the contents of the file, but save it as a string
Post Reply