1
我有YAML以下位我试图用SPYC解析(https://github.com/mustangostang/spyc/):为什么YAML不像预期的那样解析?
children:
- root:
- child one
- child two:
- subchild one
- subchild two
- child three
我希望它返回类似:
["children"]=>array(1){
["root"]=>array(3){
[0]=>string(9) "child one",
["child two"]=>array(2){
[0]=>string(12) "subchild one"
[1]=>string(12) "subchild two"
}
[1]=>string(11) "child three"
}
}
相反,它返回这样的事情(含有什么似乎是一堆空的和不必要的阵列):
array(4) {
[0]=>
array(4) {
["root"]=>
array(0) {
}
[0]=>
string(9) "child one"
[1]=>
array(3) {
["child two"]=>
array(0) {
}
[0]=>
string(12) "subchild one"
[1]=>
string(12) "subchild two"
}
[2]=>
string(11) "child three"
}
是不是有什么毛病我已经构建我YAML的方式内容可能还是有SPYC(解析器)的已知问题?
谢谢!
我的错误,谢谢你向我展示我的方式错误。现在按预期工作。 – themarkappleby