Re: How to get the URL into a var?
| From: | Andy | Date: | Thu, 31 Jan 2002 19:22:18 +0000 |
| Subject: | Re: How to get the URL into a var? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83135@lists.php.net to get a copy of this message | ||
Thanx Francois this brought me on the propper road. Works fine now!
Cheers Andy
"Francois Jordaan" <francois@fjordaan.uklinux.net> schrieb im Newsbeitrag
news:MABBIKMJCKKOJNLMMPJHKECPCIAA.francois@fjordaan.uklinux.net...
> > 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
>