note 68017 added to function.dirname
| From: | legolas558dotsourceforgecommanet at osu1 dot php dot net | Date: | Mon, 10 Jul 2006 13:52:16 +0000 |
| Subject: | note 68017 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114636@lists.php.net to get a copy of this message | ||
The best way to get the absolute path of the folder of the currently parsed PHP script is:
<?php
if (DIRECTORY_SEPARATOR=='/')
$absolute_path = dirname(__FILE__).'/';
else
$absolute_path = str_replace('\\\\', '/', dirname(__FILE__)).'/';
?>
This will result in an absolute unix-style path which works ok also on PHP5 under Windows, where
mixing '\' and '/' may give troubles.
----
Server IP: 213.92.11.19
Probable Submitter: 151.44.90.54
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- http://master.php.net/note/edit/68017
Del: integrated -- http://master.php.net/note/delete/68017/integrated
Del: useless -- http://master.php.net/note/delete/68017/useless
Del: bad code -- http://master.php.net/note/delete/68017/bad+code
Del: spam -- http://master.php.net/note/delete/68017/spam
Del: non-english -- http://master.php.net/note/delete/68017/non-english
Del: in docs -- http://master.php.net/note/delete/68017/in+docs
Del: other reasons-- http://master.php.net/note/delete/68017
Reject -- http://master.php.net/note/reject/68017
Search -- http://master.php.net/manage/user-notes.php