Re: Name of file currently being processed
| From: | Stig Sæther Bakken | Date: | Tue, 18 Jul 2000 15:47:39 +0000 |
| Subject: | Re: Name of file currently being processed | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24963@lists.php.net to get a copy of this message | ||
Joey Smith wrote:
>
> Actually, I asked the wrong question...I don't really want to do this from
> user-space (although if the mechanism is there, it might be useful in
> user-space), what I am really looking to do is to protect from recursive
> inclusion of files:
>
> p1.php
> <?
> include "p1.php";
> ?>
>
> Yes, I realize, this is a stupid error...but it seems like it might not be
> too hard to catch...
>
> main/main.c:497 (or so)
> if (filename == current_file)
> RETURN_FALSE;
Method 1:
include_once "p1.php";
Method 2:
if (defined("_p1_included_")) // no braces!
return;
include "p1.php";
- Stig