...

View Full Version : parse url based on forward slashes



surreal5335
01-05-2012, 01:28 AM
I need to parse a url using substr() or something similar based on its forward slashes.

In the end it will go from:
http://domain.com/mypage/one/

to dropping:
http://domain.com/

and leave only
mypage/one

notice The lack of the closing forward slash at the end of the original url. I appreciate any help in the matter

kbluhm
01-05-2012, 03:12 AM
$uri = trim( $_SERVER['REQUEST_URI'], '/' );

surreal5335
01-05-2012, 03:12 PM
absolutely fantastic! I thought trim() was only good for getting rid of blank spaces around the string.

Thanks a lot!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum