繁体   English   中英

如何在symfony2中添加自定义配置,例如host_name =“ www.abc.com”?

[英]how to add custom configuration e.g. host_name = “www.abc.com” in symfony2?

如何在symfony2中添加自定义配置,例如host_name =“ www.abc.com”? 我知道我们可以使用请求对象访问主机名,但是我想在symfony CLI自定义命令中使用主机名。

http://symfony.com/doc/current/cookbook/console/sending_emails.html

parameters:
    router.request_context.host: example.org
    router.request_context.scheme: https
    router.request_context.base_url: my/path

$context = $this->getContainer()->get('router')->getContext();

工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM