[英]Different configuration based on request URL in Symfony
I need to specify different configuration options for Symfony2 (eg session cookie name, locale), depending on requested URL. 我需要根据请求的URL为Symfony2指定不同的配置选项(例如,会话cookie名称,语言环境)。 Currently I am just matching URL with regexp in app.dev file, and loading different environments (with different config files), but this way seems to be a hack.
目前,我只是将URL与app.dev文件中的regexp匹配,并加载不同的环境(具有不同的配置文件),但是这种方式似乎是一种黑客。 Is there a better way to achieve it?
有没有更好的方法来实现呢?
For example, now for url: http://example.com/de/ , I am loading prod_de environment, for http://example.com/it/ , I am loading prod_it. 例如,现在对于url: http : //example.com/de/ ,我正在加载prod_de环境,对于http://example.com/it/ ,我正在加载prod_it。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.