Re: extracting a html file name
| From: | Matt Williams | Date: | Tue, 23 Apr 2002 14:02:10 +0000 |
| Subject: | Re: extracting a html file name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94162@lists.php.net to get a copy of this message | ||
On Tuesday 23 April 2002 6:59 pm, php@icecoldgold.com wrote:
> ie bill, car, jack, moneypower etc...
>
> example
>
> http://www.mydomain.com/member.php/moneypower/test.html
>
>
> I have experimented with the php variables that come in , but the only way
> I could figure out to get test.html out of there is If I captured the
> $PATH_INFO AND did a str_replace on all the html filenames on that site
> and did another one to get rid of the / . then I would have the member
> name and then i could do a string replace on the member name from the path
> info, which works , for now but as I get more files etc, it's gonna be a
> pain in the butt, there has to be a better way to do it.
Hi the function you need is explode.
try
$my_path = explode("/",$PATH_INFO);
array_shift($my_path);
so $my_path[0] will be moneypower using the above
$my_path[1] will be test.html
HTH
matt