从SimpleXMLElement对象获取价值
我有这样的事情: $url = "http://ws.geonames.org/findNearbyPostalCodes?country=pl&placename="; $url .= rawurlencode($city[$i]); $xml = simplexml_load_file($url); echo $url."\n"; $cityCode[] = array( 'city' => $city[$i], 'lat' => $xml->code[0]->lat, 'lng' => $xml->code[0]->lng ); 应该从地名下载XML。如果print_r($xml)我知道了: SimpleXMLElement Object ( [code] => Array ( [0] => SimpleXMLElement Object ( [postalcode] => 01-935 [name] => Warszawa [countryCode] => PL [lat] => 52.25 …