RE: How to get the URL into a var?
| From: | Francois Jordaan | Date: | Wed, 30 Jan 2002 22:12:02 +0000 |
| Subject: | RE: How to get the URL into a var? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82835@lists.php.net to get a copy of this message | ||
> I am trying to find out which dir the user is browsing. How
> can I get the
> URL into a var? I tryed path_info, but it only returns the filename.
I'm quite new to PHP, but I've had to do the same thing recently.
Someone mentioned
http://www.php.net/manual/en/language.variables.predefined.php
...but as far as I could tell none of them would give only "subapp" in
your example.
This may work for you:
$page_url = $REQUEST_URI;
$url_array = parse_url ($page_url);
$directory = dirname ($url_array["path"]);
print("Dir the user is browsing: $directory");
Hope that helps,
francois