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