我想创建匹配的路线:
search-results/result_Abc
search-results/result_Abc,11
search-results/result_Abc,2,3,4,6
等等。换句话说 - 当链接不提供默认值时,我希望有默认值。路线如:
search-results/result_([a-zA-Z]+)[,(\d+)]{1,8}
或者
search-results/result_([a-zA-Z]+)(\,\d+){1,8}
有效,但没有从链接中捕获任何参数(我只得到默认值)。
到目前为止,下面列出了我可以设法编写的唯一有效解决方案(需要提供所有参数)。
new Zend_Controller_Router_Route_Regex(
'search-results/result_([a-zA-Z]+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)',
array(
'module'=>'www',
'controller'=>'index',
'action'=>'searchresults',
'city' => 'wszystkie',
'distance' => 0,
'driversLicense' => 0,
'smoking' => 1,
'experience' => 0,
'languageKnowledge' => 0,
'timeDeparture' => 0,
'age' => 0,
'page' => 1
),
array(
'1'=>'city',
'2'=>'distance',
'3'=>'driversLicense',
'4'=>'smoking',
'5'=>'experience',
'6'=>'languageKnowledge',
'7'=>'timeDeparture',
'8'=>'age',
'9'=>'page'
)
)