Zend Framework 2 URL在生成URL时似乎忽略了可选的[/]?

I have a route like in my module.config.php that looks like

'route' => '/service-form/key[/][:id][/][:step]',

Despite the / being wrapped in brackets, using $this->url() returns a URL like /service-form/key// with two ending slashes. Why is this? I was under the impression that brackets made part of the route optional. Is that not the case?

Thanks in advance,

You can try this instead

'route'    => '/service-form/key[/:id][/:step]',

See ZF2 Routing for more details