note 76919 added to reserved.variables
| From: | andres at andresj dot ath dot cx | Date: | Sun, 05 Aug 2007 16:41:28 +0000 |
| Subject: | note 76919 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129193@lists.php.net to get a copy of this message | ||
To get the directory of the current script: (I think this is a little more resource-friendly, but
then again with all the fast computers available, it does not matter so much...)
<?
// For the script that is running:
$script_directory = substr($_SERVER['SCRIPT_FILENAME'], 0,
strrpos($_SERVER['SCRIPT_FILENAME'], '/'));
// If your script is included from another script:
$included_directory = substr(__FILE__, 0, strrpos(__FILE__, '/'));
echo $script_directory . '<br />';
echo $included_directory . '<br />';
?>
If you have a script that only includes the script written above in a directory called
'includer', and I access it from a web browser, this will be what I see:
/path/to/includer/
/path/to/included/
----
Server IP: 208.69.120.35
Probable Submitter: 71.202.217.120
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- https://master.php.net/note/edit/76919
Del: integrated -- https://master.php.net/note/delete/76919/integrated
Del: useless -- https://master.php.net/note/delete/76919/useless
Del: bad code -- https://master.php.net/note/delete/76919/bad+code
Del: spam -- https://master.php.net/note/delete/76919/spam
Del: non-english -- https://master.php.net/note/delete/76919/non-english
Del: in docs -- https://master.php.net/note/delete/76919/in+docs
Del: other reasons-- https://master.php.net/note/delete/76919
Reject -- https://master.php.net/note/reject/76919
Search -- https://master.php.net/manage/user-notes.php