note 85644 added to function.highlight-file
| From: | SneakyWho_am_i at osu1 dot php dot net | Date: | Wed, 10 Sep 2008 11:00:35 +0000 |
| Subject: | note 85644 added to function.highlight-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144286@lists.php.net to get a copy of this message | ||
From W on 20 August 2008:
YES! I do it too, on many of my things! I love to be able to share my code (when I have the right to
do it) with friends who aren't working on the project.
<?php
if (isset($_GET['code'])) { die(highlight_file(__FILE__, 1)); }
?>
I like to do it like this. The benefit is minimal but personally for such a small thing I would like
to keep it down to one line. Maybe there is a shorter way, I don't know.. But the magic
constant __FILE__ saves the day!
To access this one would be http://example.com/path/to/script.php?code
the parameter just has to be set (? or &) and you don't need the equals sign.
This way I don't generate any errors in E_ALL (because I'm likely in development), and I
don't have to remember if the value was supposed to be "true" or "1" or
"abacus" or whatever (I mean you're never going to specifically ask to NOT show the
code, right?)
Anyway I've gone on long enough. It's nice to not be the only one who does this :D
----
Server IP: 203.89.181.186
Probable Submitter: 125.236.211.165
----
Manual Page -- http://www.php.net/manual/en/function.highlight-file.php
Edit -- https://master.php.net/note/edit/85644
Del: integrated -- https://master.php.net/note/delete/85644/integrated
Del: useless -- https://master.php.net/note/delete/85644/useless
Del: bad code -- https://master.php.net/note/delete/85644/bad+code
Del: spam -- https://master.php.net/note/delete/85644/spam
Del: non-english -- https://master.php.net/note/delete/85644/non-english
Del: in docs -- https://master.php.net/note/delete/85644/in+docs
Del: other reasons-- https://master.php.net/note/delete/85644
Reject -- https://master.php.net/note/reject/85644
Search -- https://master.php.net/manage/user-notes.php