note 70709 added to function.dirname
| From: | Xedecimal at gmail dot com | Date: | Tue, 24 Oct 2006 18:35:10 +0000 |
| Subject: | note 70709 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119080@lists.php.net to get a copy of this message | ||
Getting absolute path of the current script:
dirname(__FILE__)
Getting webserver relative path of the current script...
function GetRelativePath($path)
{
$npath = str_replace('\\', '/', $path);
return str_replace(GetVar('DOCUMENT_ROOT'), '', $npath);
}
later on
GetRelativePath(dirname(__FILE__));
If anyone has a better way, get to the constructive critisism!
----
Server IP: 216.194.113.175
Probable Submitter: 24.21.59.130
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- https://master.php.net/note/edit/70709
Del: integrated -- https://master.php.net/note/delete/70709/integrated
Del: useless -- https://master.php.net/note/delete/70709/useless
Del: bad code -- https://master.php.net/note/delete/70709/bad+code
Del: spam -- https://master.php.net/note/delete/70709/spam
Del: non-english -- https://master.php.net/note/delete/70709/non-english
Del: in docs -- https://master.php.net/note/delete/70709/in+docs
Del: other reasons-- https://master.php.net/note/delete/70709
Reject -- https://master.php.net/note/reject/70709
Search -- https://master.php.net/manage/user-notes.php