我如何創建和使用symfony中的鍵/值自己的全局配置? 我試圖設置parameters.yml
下的parameters
線,它在安裝後已經在這個文件中,並得到它像$pageTitle = $this->getParameter('myKey');
和它的工作原理,但我想要自己整個配置文件的結構爲前。 $this->getParameter('myParameters.myKey')
這樣:Symfony 3擁有全局配置文件
我創建新的文件:
#app/config/myConfig.yml
myParameters:
myKey: myValue
在config.yml我說:
#app/config/config.yml
imports:
- { resource: myConfig.yml }
和控制器:
$pageTitle = $this->getParameter('myKey');
,我有例外:
FileLoaderLoadException在FileLoader.php行118:沒有擴展能夠加載配置 「inyconfig」(中....
編輯
這個例子工作,但你必須做一個小變化 - myParameters
更改爲parameters
,一切都像魅力一樣工作。
給我一些反饋 – Timan