I am just making my own MVC. However, I’ve encountered a problem. As you know before, if there is a URL like “www.site.com/users/star”, “users” is defined as a controller and “star” is defined as a method in MVC style. So, I assume that I want to make a profile page for users. I need a url such as “www.site.com/user/{username}”. In this case, username is being evaluated as a method, but it must not be. It is just user’s name. How can I prevent this complexity?
Here is my bootstrap.php:
http://tinypaste.com/75cd8487
Thanks in advance..
A lot of frameworks have the concept of routes. With routes, the URL is not the concrete definition of the controller/action. You can specify a route like
'users/*'and have it point to the users controller and view action. Then, it’s up to the controller to deal with the different params.