note 94942 added to function.realpath
| From: | roman dot vasicek at email dot cz | Date: | Thu, 03 Dec 2009 17:01:16 +0000 |
| Subject: | note 94942 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163547@lists.php.net to get a copy of this message | ||
You may want to change script behavior depending on the way how its code is invoked (included by
another script / called directly). Following code do the job
<?php
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
// called directly
...
} else {
// included
...
}
?>
----
Server IP: 192.41.40.227
Probable Submitter: 165.72.200.11
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/94942
Del: integrated -- https://master.php.net/note/delete/94942/integrated
Del: useless -- https://master.php.net/note/delete/94942/useless
Del: bad code -- https://master.php.net/note/delete/94942/bad+code
Del: spam -- https://master.php.net/note/delete/94942/spam
Del: non-english -- https://master.php.net/note/delete/94942/non-english
Del: in docs -- https://master.php.net/note/delete/94942/in+docs
Del: other reasons-- https://master.php.net/note/delete/94942
Reject -- https://master.php.net/note/reject/94942
Search -- https://master.php.net/manage/user-notes.php