开发者

controller class naming convention conflict (php)

开发者 https://www.devze.com 2023-02-25 03:29 出处:网络
I am building an MVC framework. I am using the PEAR naming convention. Classes have the first letter of each word capitolized.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号