note 28048 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 00:40:56 +0000 |
| Subject: | note 28048 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59780@lists.php.net to get a copy of this message | ||
Note Submitter: murat@nospamx.robcol.k12.tr
----
Another interesting thing about the included files is that they return the includer's file
information when you use server variables. For example let's say you have two files like this:
/included.php
=========
<? echo $_SERVER['PHP_SELF']; ?>
/caller.php
=======
<? include "included.php"; ?>
When caller.php is called, PHP will print "/caller.php" although the echo function is
actually called from the /included.php file.
This might be very useful when you create a logger script which will log the caller page's
relative url, time, etc. to a database every time a page is viewed. You would simply use <?
include "logthis.php"; ?> at the beginning of each page you would wish to be logged.