Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a config file without processing it?

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Ok, basically what I am trying to do is (in PHP) read a config file, and then echo it out from a variable. What I am using is;

Code:
function edit_settings() {

$input = file("settings.inc.php");

         foreach ($input as $line) {

         $return = ereg_replace("\$", "\\$", $line);

         echo $return;;

         } // end foreach

}

As you can see I already tried to escape the $'s but backslashing them before echoing, but that didn't help. Is there actually a way to read a file, and then echo it without the code being processed?

Thanks

Andy
 
Just use fopen to open the file and fread, then output every line with the echo statement. Put htmlentities around it. mcvdmvs
"It never hurts to help" -- Eek the Cat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top