$xml=simplexml_load_file('city_index.xml');
//print_r ($xml->city_index->location[2]->attributes());
foreach($xml->city_index->location as $location )
{
print_r ($location->attributes());
$provinceXml=(string)$location->attributes()['province'];
$cityXml=(string)$location->attributes()['city'];
$countyXml=(string)$location->attributes()['county'];
echo "$countyXml:".$countyXml."<br>";
if($provinceXml==="广东省" && $cityXml==="广州市" && FALSE!=strstr("从化市",$countyXml))
{
echo $location->attributes()['county']."<br>";
echo $location->brief."<br>";
echo $location->specialty."<br>";
}
/*
foreach($location->attributes() as $key => $value)
{
echo $key,'="',$value,"\"<br>";
}
*/
}
//print_r ($xml->city_index->location[2]->attributes());
foreach($xml->city_index->location as $location )
{
print_r ($location->attributes());
$provinceXml=(string)$location->attributes()['province'];
$cityXml=(string)$location->attributes()['city'];
$countyXml=(string)$location->attributes()['county'];
echo "$countyXml:".$countyXml."<br>";
if($provinceXml==="广东省" && $cityXml==="广州市" && FALSE!=strstr("从化市",$countyXml))
{
echo $location->attributes()['county']."<br>";
echo $location->brief."<br>";
echo $location->specialty."<br>";
}
/*
foreach($location->attributes() as $key => $value)
{
echo $key,'="',$value,"\"<br>";
}
*/
}