Re: Which file am I ?
| From: | Soeren Staun-Pedersen | Date: | Wed, 16 Aug 2000 07:39:56 +0000 |
| Subject: | Re: Which file am I ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11941@lists.php.net to get a copy of this message | ||
> I need to know wether a file "test.php" has been included in some other
> file or is called directly.
>
> Therefor, I want to compare the PATH_INFO and the filename "test.php".
> This works fine.
>
> Now I have a lot of files like "test.php" all with different names. How
> can I get the filename without saying $this_file = "..." ? I found
> nothing in phpinfo(). When the file is included, only the name of the
> file, which includes my file, is shown.
Some people like to use define() for this (ala c++ precompiler directives)
ala:
<?php
if (!defined("__FUNCTIONS__"))
{
define("__FUNCTIONS__",1);
//functions code
...
}
?>
This will guarane a single include only, and create a way for you to know
which files you included. Does this help you in anyway?
Soeren Staun-Pedersen - staun@netwarriors.org
------
"The internet is full, beat it"
- Me.