note 96666 added to function.get-included-files
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 10 Mar 2010 15:39:56 +0000 |
| Subject: | note 96666 added to function.get-included-files | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166865@lists.php.net to get a copy of this message | ||
in reply to: keystorm :at: gmail dotcom
This is quite useful to detect is current script was included or if it is that got called in the
first place. But there is one gotcha:
If you run the script via CLI, $_SERVER['SCRIPT_FILENAME'] can be the relative path to the
called script. In this case, simply comparing __FILE__ to it won't work.
to be sure that the comparison works, you should use the following:
__FILE__ != realpath( $_SERVER['SCRIPT_FILENAME'] )
----
Server IP: 69.147.83.197
Probable Submitter: 69.70.10.188
----
Manual Page -- http://www.php.net/manual/en/function.get-included-files.php
Edit -- https://master.php.net/note/edit/96666
Del: integrated -- https://master.php.net/note/delete/96666/integrated
Del: useless -- https://master.php.net/note/delete/96666/useless
Del: bad code -- https://master.php.net/note/delete/96666/bad+code
Del: spam -- https://master.php.net/note/delete/96666/spam
Del: non-english -- https://master.php.net/note/delete/96666/non-english
Del: in docs -- https://master.php.net/note/delete/96666/in+docs
Del: other reasons-- https://master.php.net/note/delete/96666
Reject -- https://master.php.net/note/reject/96666
Search -- https://master.php.net/manage/user-notes.php