更新时间:2022-04-18 05:36:58
默认情况下禁止使用斜杠.您可以通过更改默认要求来启用它们.在你的情况下,给出对 id 的要求也很好,因为它用破折号分隔.
Slashes are by default forbidden. You can enable them by changing the default requirements. In your case it'd be also good to give requirements for the id as it's separated with dash.
见下面的例子.
region:
pattern: /regione/{slug}-{id}
defaults:
_controller: SWAItaliaInCifreBundle:Default:region
requirements:
slug: "[a-zA-Z1-9-_/]+"
id: "d+"