I am building an MVC framework. I am using the PEAR naming convention. Classes have the first letter of each word capitolized.
The problem is when I get to the controller classes. The framework loads the controller based on the URL path. I do not however want to need uppercase letters in my URLs. Is ther开发者_Python百科e a common way to deal with this problem?
Just fetch the name of the controller from the url (e.g. /controller/action/id
) and use ucfirst()
to get the class name of your controller. That's the common way to do it.
精彩评论