Re: check if a file is included
| From: | Nathan Rixham | Date: | Fri, 12 Sep 2008 12:59:06 +0000 |
| Subject: | Re: check if a file is included | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-279977@lists.php.net to get a copy of this message | ||
clive wrote:
I have a file called interceptor.php, which I would like to make use of in two ways 1. either call it directly from the browser or 2. included from another file I know I could use something like this to see if it was called via a url like http://www.site.com/interceptor.php : if (strstr('interceptor',$__SERVER["REQUEST_URI"])) { // url } else { //probably included } but I would like to know if there is a neater, cleaner, sparkly way of doing this. Thanks Cliveif( isset($variable_not_defined_in_interceptor_but_is_defined_in_file_used_to_include_interceptor) ) { or a shorter variable name..