我已经配置了这两条路线
$app->match ( '/controller/param/{country}/{q}', "demo.controller:demoAction" )->value ( 'country', 'de' )->value('q', '')->bind ( 'demo_action_with_country' );
$app->match ( '/controller/param/{q}', "demo.controller:demoAction" )->value ( 'q', '' )->bind ( 'demo_action_without_country' );但是--这是行不通的。如果我调用/controller/param/Test-String,则路由匹配并返回内容。如果我打电话给/controller/param/DE/Test-String,我就能得到NotFoundHttpException
我怎样才能解决这个问题?
发布于 2013-07-26 12:51:03
好吧,我可以自己解决。这是我的解决方案:
$app->match ( '/controller/param/{q}', "demo.controller:demoAction" )->value ( 'q', false )->bind ( 'demo_action_without_country' );
$app->match ( '/controller/param/{country}/{q}', "demo.controller:demoAction" )->value ( 'country', false )->value('q', '')->bind ( 'demo_action_with_country' );https://stackoverflow.com/questions/17881459
复制相似问题