Re: include orgin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux