对于那些想知道为什么Zend_Controller_Router_Route_Regex
匹配大小写不同的路线的人,例如。hxxp://example.com/EN vs. hxxp://example.com/en,这里有一个解释。
Zend_Controller_Router_Route_Regex
隐式不区分大小写。它在Zend_Controller_Router_Route_Regex::match()
方法中设置。这是设置PCRE_CASELESS
修饰符的一段代码:
if (!$partial) {
$path = trim(urldecode($path), '/');
$regex = '#^' . $this->_regex . '$#i';
} else {
$regex = '#^' . $this->_regex . '#i';
}
我不知道是否有任何方法可以从正则表达式内部抑制这种行为。有任何想法吗?