Web lists-archives.com

[PHP] Detect php filepath




Hello, I'm writing in PHP 5.

How can I get the local and/or public path of the script file with
current function? And a caller one?

Example:
/srv/www/index.php includes material/index.php
/srv/www/material/index.php includes ../functions.php

in /srv/www/functions.php :
function LocalFileIAm()
{
	return ...;
}
function RemoteFileIAm()
{
	return ...;
}

in /srv/www/material/index.php :
echo '<p>Materials local index file is at: '.LocalFileIAm().'</p>';
echo '<p>Materials public index file is at: '.RemoteFileIAm().'</p>';

Wnen visiting http://www.mysite.net/index.php browser should show:
Materials local index file is at: /srv/www/material/index.php
Materials public index file is at: /material/index.php

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php