If it's Path_To_DocumentRoot/a/b/c.php
,should always be /a/b
.
I use this:
dirname($_SERVER["PHP_SELF"])
But it won't work when it's included by another file in a different directory.
EDIT
I need a relative path to document root .It's used in web application.
I find there is another question with the same problem,but no accepted answer yet.
http://stackoverflow.com/questions/1240462/php-convert-file-system-path-to-url