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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx * society and not sufficient moral courage.
(work) davidtgwork@xxxxxxxxxxxxxxx  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00081.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux