如何从parameters.yml中读取数组内的关联数组的值

时间:2017-07-11 16:49:30

标签: symfony yaml symfony-2.8

我有我的parameters.yml:

parameters:
    housing_type: 
      - 1: 220
        2: 180
        3: 280

我想获取housing_type[1]的值,即。从控制器内部220,所以我使用

$this->container->getParameter('housing_type[$val]');

但它说

parameter 'housing_type[$val]' must be defined

任何想法如何获取数组中数组的值?

0 个答案:

没有答案