faqts : Computers : Programming : Languages : PHP : Common Problems : Tips and Tricks

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 29 people (48%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How can you display your PHP source code to the browser?

Jul 13th, 2000 21:00
Philip Olson, Matt Gregory, Tony Tocco, Krister Konst, zend.com


One way is to use the fopen method to open your script, read it in, use 
the addslashes function to make it printable, and then print it out to 
the browser.
a little script that something simular is found here :
   http://www.zend.com/codex.php?id=203&single=1
so basically with this script you'll link to your pages like this :
   http://www.blah.com/viewsource.php?source=file.php