Re: include orgin
| From: | Jim Lucas | Date: | Fri, 04 Apr 2014 05:22:52 +0000 |
| Subject: | Re: include orgin | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323150@lists.php.net to get a copy of this message | ||
On 4/3/2014 9:18 PM, haiwen zhu wrote:
Hi all, I have 2 fiels, a.php *<?php* *include 'b.php';* b.php *<?php* *echo __FILE__;//i want to know a.php include me.* I wonder if there is a way to know who include me in b.php?I can think of a few different variables that can give you this info. Depends on your usage though... echo basename($_SERVER['PHP_SELF']); echo basename($_SERVER['SCRIPT_NAME']); echo basename($_SERVER['REQUEST_URI']); echo basename($_SERVER['PATH_INFO']); $path_parts = pathinfo('/path/to/script.php'); echo $path_parts['basename']; Hope this gets you the info you are looking for. Jim Lucas