mikeken Posted June 7, 2011 Share Posted June 7, 2011 Hi all, I am creating a small custom php mvc framework that I can re-use in all of my projects. So assuming that I am getting a request_uri of /customframework/aboutus how would I "parse" that in php to extract the aboutus or whatever else it might be from the string? Also, is there a good way to ignore any trailing slashes if there are any? For example, if the request_uri was /customframework/aboutus/// I would still want to know just the aboutus in a string Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/238710-bootstrapping-how-to-parse-request_uri/ Share on other sites More sharing options...
AbraCadaver Posted June 7, 2011 Share Posted June 7, 2011 basename() or pathinfo(). Quote Link to comment https://forums.phpfreaks.com/topic/238710-bootstrapping-how-to-parse-request_uri/#findComment-1226648 Share on other sites More sharing options...
trq Posted June 8, 2011 Share Posted June 8, 2011 There can be a fair bit more to it than simply parsing the url for different segments. It's not exactly something that would be easily described within a simple forum post. I would take a look at some of the other frameworks and in particular there routing. If your looking for something simple to use as an example, my framework (Proem) linked to via the Github link in my signature has a fairly basic routing system (still incomplete). Quote Link to comment https://forums.phpfreaks.com/topic/238710-bootstrapping-how-to-parse-request_uri/#findComment-1226800 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.