Re: URL parsing

From: Date: Sun, 25 Mar 2001 19:11:42 +0000
Subject: Re: URL parsing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45507@lists.php.net to get a copy of this message
oops :) http://www.domain.com/index.php/main/index.html?ii=1 versus http://www.domain.com/index.php/main/index.html I want to get "index.html" and "main" into variables, as the two items will always be present - if $ii is set, I want to strip it from the URI before parsing the items out. I suppose with parse_url() I could do something..but I really only want to deal with the URI. currently, this seems to work: $path_array = explode('/', $REQUEST_URI); if (isset($ii)) array_pop($path_array); // remove $ii $page_name = array_pop($path_array); //get page name from end of array $tpl = array_pop($path_array); //get page type from next item but is inelegant :) regards, jaxon > In article <B6E3A463.429C%jaxon@salamander.net>, > jaxon@salamander.net (Jaxon) wrote: > >> Any way to combine both forms of url parsing? >> I want to use standard slash notation for navigation ,but also account for >> the occasional variable used within a single page. >> >> e.g. URL can be either: >> domain.com/index.php/main/index.html?ii=1 >> >> or: >> domain.com/index.php/main/index.html?ii=1 > > Umm, how are these different? > > (If you're trying to extract info from a url, perhaps > parse_url(),basename(), and/or dirname() are what you're seeking...?)

« previous php.general (#45507) next »