symfony2 컨트롤러에서 변수 파일을 얻는 방법 app/config/parameters.yml.symfony2의 매개 변수 파일에서 변수 가져 오기
parameters:
host_name: www.mydomain.con
symfony2 컨트롤러에서 변수 파일을 얻는 방법 app/config/parameters.yml.symfony2의 매개 변수 파일에서 변수 가져 오기
parameters:
host_name: www.mydomain.con
당신이
$this->container->getParameter('host_name');
당신은 할 수 :
$this->container->getParameter('host_name');
확인이 밖으로
$this->container->getParameter('host_name');
And if you want in twig then try like below
Add in app/config/config.yml like:
twig:
globals:
host_name: '%host_name%'
and in twig file use as normal variable like:
{{host_name}}
Enkoy처럼 얻을 것이다!
[Documentation] (http://symfony.com/doc/current/components/dependency_injection/parameters.html)은 사용 사례에 매우 유용합니다 – Touki