Re: Downloading PHP source from a PHP filename, possible?

From: Date: Sat, 29 Nov 2003 03:35:16 +0000
Subject: Re: Downloading PHP source from a PHP filename, possible?
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-31808@lists.php.net to get a copy of this message
Jerry -- ..and then JeRRy said... % % Hi, Hi! % .. % If a file is called blah.php and is only tailored to % PHP code is it possible to make it downloadable either % as a file-download or appear as plain text in a % browser window? You could probably manage anything, though it might be a little tricky; if you really insisted on having just the one file, I'd actually have a wrapper script which is allowed to display the php source of another file. Hmmm... As I think about it, there's probably no reason that special script couldn't display itself, which means there's no reason your original file couldn't display itself either; you'd no doubt have a "display" function just for that. Gonna have to think about that one. Anyway, what I usually do if I have a need to display the source of running code is just make a symlink as either blah.txt or blah.phps (depending on whether I want it to be readable on the surfer's windows box after downloading or want colorization by apache) so that I save space and have only one thing to maintain. I could use a hard link but then it's easy to forget that it's a link :-) But I'm going to have to go and think about including and recursion for a bit, starting with how to do it for some specific other file. It could be as easy as print file("blah.php") ; or such... HTH & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.db (#31808) next »