このコードで:
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->addRoute(
'test',
new Zend_Controller_Router_Route(
'/test/:action/:type/:id',
array(
'controller' => 'admin'
)
)
);
http:// app / test / param1 / param2 / param3- > OK
http:// app / test / param1 /param2/ ->失敗
2番目のケースでは、アプリケーションはparam2を認識しません。
アプリケーションがparam2を読み取るためにparam3が必要なようです...
どうすればいいですか?
ありがとう!
@RageZのコードでテストする
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->addRoute(
'test',
new Zend_Controller_Router_Route(
'/test/:action/:type/:id',
array(
'controller' => 'admin',
'id' => 0
),
array(
'id' => '\d+'
)
)
);
http:// app / test / -> OK
http:// app / test / some- > OK
http:// app / test / some / more-> FAIL
http:// app / test / some / more / andmore- > OK
アイデア?