我有以下路由定义:
'admin_default' => array(
'type' => 'segment',
'options' => array(
'route' => '[/:lang]/administrator[/:module][/:action]',
'constraints' => array(
'lang' => '[a-zA-Z]{2}',
'module' => '[a-zA-Z0-9_-]*',
'action' => '[a-zA-Z0-9_-]*',
),
'defaults' => array(
'module' => 'Application',
'controller' => 'Admin',
'action' => 'index',
'lang' => 'ru'
),
),
'may_terminate' => true,
'child_routes' => array(
'wildcard' => array(
'type' => 'wildcard',
'may_terminate' => true,
'options' => array(
'key_value_delimiter' => '/',
'param_delimiter' => '/'
),
),
),
),
所以,我无法摆脱 URL 字符串中的段 [/:lang]
例如:
URL 视图助手$this->url('admin_default', array('module' => 'albums'))
返回以下 URL 字符串:
/administrator/albums
而$this->url('admin_default/wildcard', array('module' => 'albums', 'action' => 'edit', 'id' => album_id_here))
返回:
/ru/administrator/albums/edit/id/album_id_here
在第二种情况下,如何从 URL 字符串中删除 [/:lang] 段?