Re: include orgin

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

 



On Fri, Apr 4, 2014 at 1:22 PM, Jim Lucas <lists@xxxxxxxxx> wrote:

> 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
>


 I think this is a way to get what i want, thanks for your replay:-)

-- 

Best Regards,
HaiwenZhu

[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