I'm doing this which works fine:
我这样做很好:
parameters:
array_name1: [a, b, c, d]
array_name2: [x, y, a, b]
Now I need to add what in PHP would be $array_name3[1] = array("a", "b", "c") etc., so something like this:
现在我需要在PHP中添加$ array_name3 [1] = array(“a”,“b”,“c”)等等,这样的事情:
parameters:
array_name3[1]: [1, 2, 3]
array_name3[2]: [a, b, c]
array_name3[3]: [x, y, z]
...which of course doesn't work. Nothing I try seems to be accepted.
......当然不起作用。我没有尝试任何东西似乎被接受。
How do I define multi-dimensional arrays in Yaml (Symfony2)?
如何在Yaml(Symfony2)中定义多维数组?
1 个解决方案
#1
52
Try this
尝试这个
parameters:
array_name3:
- [1, 2, 3]
- [a, b, c]
- [x, y, z]
Or if you want to have it associative:
或者如果你想让它关联起来:
parameters:
array_name3:
1: [1, 2, 3]
2: [a, b, c]
bla: [x, y, z]
Or if you want more - read documentation
或者如果你想要更多 - 阅读文档
#1
52
Try this
尝试这个
parameters:
array_name3:
- [1, 2, 3]
- [a, b, c]
- [x, y, z]
Or if you want to have it associative:
或者如果你想让它关联起来:
parameters:
array_name3:
1: [1, 2, 3]
2: [a, b, c]
bla: [x, y, z]
Or if you want more - read documentation
或者如果你想要更多 - 阅读文档