5.11 URL大小写
匿名 · 更新于 2013/12/24
我们知道,系统默认的规范是根据URL里面的moduleName和actionName来定位到具体的模块类,从而执行模块类的操作方法,如果在Linux环境下面,就会发生URL里面使用小写模块名不能找到模块类的情况,例如在Linux环境下面,我们访问下面的URL是正常的:
http://serverName/index.php/User/add
http://serverName/index.php/user/add
其实,系统本身已经提供了一个良好的解决方案,可以通过配置简单实现。
只要在项目配置中,增加:
'URL_CASE_INSENSITIVE' =>true
http://serverName/index.php/User/add//将等效于http://serverName/index.php/user/add
http://serverName/index.php/user_type/list//而不是http://serverName/index.php/usertype/list
如果设置
'URL_CASE_INSENSITIVE' =>false
http://serverName/index.php/UserType/list
