为什么输出会因API调用而改变数组?

时间:2017-05-01 06:56:40

标签: php arrays api drupal array-key

假设我有一个API,它会产生一个对象数组。 像

[{
    "cipcode": "03.0104",
    "major": "Environmental Science"
}, {
    "cipcode": "03.0201",
    "major": "Natural Resources Management and Policy"
}, {
    "cipcode": "03.0501",
    "major": "Forestry, General"
}, {
    "cipcode": "03.0502",
    "major": "Forest Sciences and Biology"
}

.........直到100键

但是当计数从100开始越过时,数组现在变得像

{
"0": {
    "cipcode": "03.0103",
    "major": "Environmental Studies"
},
"1": {
    "cipcode": "03.0104",
    "major": "Environmental Science"
},
"2": {
    "cipcode": "03.0502",
    "major": "Forest Sciences and Biology"
},
"3": {
    "cipcode": "05.0202",
    "major": "American Indian/Native American Studies"
},
"4": {
    "cipcode": "05.0207",
    "major": "Women's Studies"
},
"5": {
    "cipcode": "09.0101",
    "major": "Speech Communication and Rhetoric"
}

.......直到101键

任何人都可以解释为什么会发生这种情况......我想要的解决方案是什么?无论是否有任何密钥数,我都希望得到以前的格式。

0 个答案:

没有答案