Re: URL parsing

From: Date: Sat, 24 Mar 2001 02:30:47 +0000
Subject: Re: URL parsing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45395@lists.php.net to get a copy of this message
Well assuming that this: index.php/tpl/main/ii/1/pagename/name.html is representative of this: index.php?tpl=main&ii=1$pagename=name.html then: $path_array = explode('/', $REQUEST_URI); $numPathElements = count($path_array); gives me: $path_array[0] = tpl $path_array[1] = main $path_array[2] = ii $path_array[3] = 1 $path_array[4] = pagename $path_array[5] = name.html But can I make that: $path_array[tpl] = main $path_array[ii] = 1 $path_array[pagename] = name.html Instead? I'm going to have to do this for every page, so I want to avoid much that would slow the page down - what do folks think? regards, jaxon On 3/23/01 9:09 PM, "Aaron Tuller" <mandelbaum@olywa.net> wrote: > super easy. > > $path_array = explode('/', $REQUEST_URI); > $numPathElements = count($path_array); > > then loop through the elements and do what you need, you might need > to use strtok() if you're expecting slashes in your arguments. > > -aaron > > At 8:58 PM -0500 3/23/01, Jaxon wrote: >> how about parsing a url from passing variables like : >> test.php/op/3/op2/6/pagename.html >> >> cannot this be parsed, to let search engines spider past the "?" properly? >> >> regards, >> jaxon >> >> On 3/23/01 7:46 PM, "Richard Lynch" <richard@zend.com> wrote: >> >>> I think you can change the separator in php.ini, and for sure you could do >>> it by hand using $PATH_INFO or something. >>> >>> Personally, my first question would be if the new "standard" is actually >>> being used or supported by anybody else... >>> >>> -- >>> Visit the Zend Store at http://www.zend.com/store/ >>> Wanna help me out? Like Music? Buy a CD: <[]^„‹\ ©G:¨ä >>> Ìhhttp://l-i-e.com/artists.htm >>> Volunteer a little time: >>> http://chatmusic.com/volunteer.htm >>> ----- Original Message ----- >>> From: Dave Smith <dave.s@earthcorp.com> >>> Newsgroups: php.general >>> Sent: Saturday, March 17, 2001 10:55 AM >>> Subject: [PHP] URL parsing >>> >>> >>>> I have heard that the new standard for URLS is ...test.php?op=3;op2=6... >>>> using the semi colon as a seperator. Is this currently supported by php >>> 4.0.3? >>>> >>>> Cheers >>>> >>>> Dave Smith >

« previous php.general (#45395) next »