I have the following route in my module.config.php
:
'routes' => array(
'admin' => array(
'type' => 'Segment',
'options' => array(
'route' => '/admin[/:controller[/:action]][/]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]+',
'action' => '[a-zA-Z][a-zA-Z0-9_-]+',
),
'defaults' => array(
'__NAMESPACE__' => 'Admin\Controller',
'module' => 'Admin',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'wildcard' => array(
'type' => 'Wildcard',
)
),
'priority' => 1000
),
),
The reason for the [/]
in the end of the route is in the question: Zend Framework 2 Segment Route matching 'test' but not 'test/'
I want this route to be like in ZF1. I want to pass $_GET parameters
in it (like /id/1/test/2/
).
The problem it this route is actually matching /admin/customer/edit//id/20
but not matching /admin/customer/edit/id/20
Any ideas?
You can add route parameter for id :
this route matchs
admin/customer/edit/20/
, so you can get id in controller:If you want to have
admin/customer/edit/id/20/
,try: