note 91222 added to function.realpath
| From: | singh206 at gmail dot com | Date: | Sun, 31 May 2009 02:48:40 +0000 |
| Subject: | note 91222 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156193@lists.php.net to get a copy of this message | ||
to get the relative can't you just strip the root from the realpath?
$realpath = realpath(__FILE__);
$root = $_SERVER['DOCUMENT_ROOT'].'/';
$relative = str_replace($root, '', $realpath);
echo "realpath: $realpath<br />";
echo "relative: $relative<br />";
You could use a regex to limit the replacement to the first occurence.
----
Server IP: 208.69.120.35
Probable Submitter: 98.203.250.105
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/91222
Del: integrated -- https://master.php.net/note/delete/91222/integrated
Del: useless -- https://master.php.net/note/delete/91222/useless
Del: bad code -- https://master.php.net/note/delete/91222/bad+code
Del: spam -- https://master.php.net/note/delete/91222/spam
Del: non-english -- https://master.php.net/note/delete/91222/non-english
Del: in docs -- https://master.php.net/note/delete/91222/in+docs
Del: other reasons-- https://master.php.net/note/delete/91222
Reject -- https://master.php.net/note/reject/91222
Search -- https://master.php.net/manage/user-notes.php