Re: website tree
| From: | Daniel Brown | Date: | Sat, 05 Jan 2008 17:25:34 +0000 |
| Subject: | Re: website tree | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266795@lists.php.net to get a copy of this message | ||
On Jan 5, 2008 12:06 PM, Alain Roger <raf.news@gmail.com> wrote:
> Hi,
>
> let's imaging we have the following thing :
>
> www.mywebsite.com/company/index.php
> www.mywebsite.com/company/profile.php
> www.mywebsite.com/services/index.php
>
> how can i detect in which address am i ?
>
> for example how to retrieve www.mywebsite.com/services or
> www.mywebsite.com/company
<?
preg_match('/\/(.*)\//',$_SERVER['REQUEST_URI'],$match);
echo $match[1];
?>
--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]
If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.