Page 1 of 1

Reading a php file and outputting contents

Posted: Sun Sep 28, 2003 2:13 pm
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;


?>

Posted: Sun Sep 28, 2003 3:37 pm
by jason

Posted: Sun Sep 28, 2003 9:42 pm
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