note 94942 deleted from function.realpath by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 09:51:24 +0000 |
| Subject: | note 94942 deleted from function.realpath by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210721@lists.php.net to get a copy of this message | ||
Note Submitter: roman dot vasicek at email dot cz
----
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
...
}
?>