Zend Framework Router

Good day!
Tell me, how to write a router to query site.ru/id123where 123 is a variable number.
If you want site.ru/id/123 it works this option:
new Zend_Controller_Router_Route('id/:id', array('module' => 'default', 'controller' => 'user', 'action' => 'profile'))
But for id123 not clear.
new Zend_Controller_Router_Route('id:id', array('module' => 'default', 'controller' => 'user', 'action' => 'profile'))
Like this, but this is not working.
October 8th 19 at 01:42
1 answer
October 8th 19 at 01:44
Solution
Use routers based on the regexps
Route("id/id(\d+)", array(
 'module' => 'default',
 'controller' => 'user',
 'action' => 'profile',
 1 => 'id'
)

framework.zend.com/manual/ru/zend.controller.router.html#zend.controller.router.routes.regex here is explained in detail
Thank you, it works!
new Zend_Controller_Router_Route_Regex('id(\d+)', array('module' => 'default', 'controller' => 'user', 'action' => 'profile')) - enoch_Schmidt commented on October 8th 19 at 01:47
I do not understand why they did the other routers except regexps =) URLs short and work out the regular season with a Bang, the speed is not affected. - aniya.Kertzmann65 commented on October 8th 19 at 01:50
Probably because the regular season is not the fastest option?
In Kohana in General, lambdas in routing use, but they clearly write that if you can do without them, it is better to do without them. :) - Ryleigh_Nicol commented on October 8th 19 at 01:53
"Short URLs and work out the regular season with a Bang, the speed is not affected."
I must take this into account. Of the regular season in simple terms are working as fast as strings (without special characters they pass the line once, as a function of type substr) - aniya.Kertzmann65 commented on October 8th 19 at 01:56

Find more questions by tags Network equipmentZend FrameworkPHP