我需要使用 geonames api 获取所有国家/地区。我可以$geonames->genomes[2]->countryName
用来获取第二个国家名称。但我希望它自动像while()
我如何while()
在 php 中使用它一样?
JSON 在这里
{"geonames":[{"countryName":"Andorra","currencyCode":"EUR","fipsCode":"AN","countryCode":"AD","isoNumeric":"020","north":42.65604389629997,"capital":"Andorra la Vella","continentName":"Europe","areaInSqKm":"468.0","languages":"ca","isoAlpha3":"AND","continent":"EU","south":42.42849259876837,"east":1.7865427778319827,"geonameId":3041565,"west":1.4071867141112762,"population":"84000"},{"countryName":"United Arab Emirates","currencyCode":"AED","fipsCode":"AE","countryCode":"AE","isoNumeric":"784","north":26.08415985107422,"capital":"Abu Dhabi","continentName":"Asia","areaInSqKm":"82880.0","languages":"ar-AE,fa,en,hi,ur","isoAlpha3":"ARE","continent":"AS","south":22.633329391479492,"east":56.38166046142578,"geonameId":290557,"west":51.58332824707031,"population":"4975593"}]}