我可以在一个地方而不是每个路线配置以下选项吗?
在我的routing.yml
文件中,每条路线都有:
options:
utf8: true
因为
在 Symfony 3.2 中,不需要显式设置 utf8 选项。一旦 Symfony 在路由路径或需求中找到 UTF-8 字符,它就会自动打开 UTF-8 支持。但是,此行为已被弃用,并且在 Symfony 4.0 中将需要设置该选项。
使用注释可以routing.yml
为如下定义的所有路由配置默认选项AppBundle/Controller/
:
app_bundle:
resource: "@AppBundle/Controller/"
type: annotation
schemes: "https"
options: { utf8: true }
使用Yaml,您可以尝试将此指令放在第一个位置routing.yml
:
app_name:
path: ^/
#path: ^/* <-- another attempt to include all routes after the first /
options: { utf8: true }
#host: <-- maybe you should specify this and/or other params depending by your needs.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句