2
對於那些想知道爲什麼Zend_Controller_Router_Route_Regex
匹配大小寫不同的路由,例如。 hxxp://example.com/EN與hxxp://example.com/en,這裏有一個解釋。Zend_Controller_Router_Route_Regex不區分大小寫
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';
}
我不知道是否有任何辦法從正則表達式的內抑制這種行爲。有任何想法嗎?