elmu
11-05-2007, 08:35 PM
Hello,
I want to get the actual base directory in my PHP script. Now I use the following code to get the actual location:
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
In case of http://mysite/test/index.php the result is mysite/test/index.php and in case of http://mysite/test the result is mysite/test.
I want to get only the directory path (mysite/test) without filename in both cases.
I have tried pathinfo(), dirname() but both removes always the last tag independent if it is a file or dir. So in case of http://mysite/test I got only mysite instead of mysite/test.
Any idea how to solve this?
I want to get the actual base directory in my PHP script. Now I use the following code to get the actual location:
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
In case of http://mysite/test/index.php the result is mysite/test/index.php and in case of http://mysite/test the result is mysite/test.
I want to get only the directory path (mysite/test) without filename in both cases.
I have tried pathinfo(), dirname() but both removes always the last tag independent if it is a file or dir. So in case of http://mysite/test I got only mysite instead of mysite/test.
Any idea how to solve this?