Can an array be specified in an ini file to be parsed using Zend_Config_Ini

前端 未结 3 995
死守一世寂寞
死守一世寂寞 2021-02-05 02:20

Is there a way to specify a one dimensional array in a ini file.

so in my ini I would like to do

someproperty = [array of something]

I am using Ze

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 02:50

    You can use separators to make further sub-sections, and they are presented as either another level of objects ($config->some->a) or with $config->toArray(), they can be turned into a multi-level array.

    Combining both the above techniques to make arrays, and the separators like so:

    some.a[] = a
    some.a[] = b
    some.b[] = c
    

    will give the results you are looking for.

    array('some' => array('a' => array(0 => 'a',
                                       1 => 'b'),
                          'b' => array(0 => 'c')
                         ));
    

提交回复
热议问题