note 28048 added to function.include
| From: | murat at nospamx dot robcol dot k12 dot tr | Date: | Mon, 30 Dec 2002 23:15:46 +0000 |
| Subject: | note 28048 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41496@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.include.php
http://master.php.net/manage/user-notes.php?action=edit+28048
http://master.php.net/manage/user-notes.php?action=delete+28048
http://master.php.net/manage/user-notes.php?action=reject+28048