PHP XML转数组问题,求帮忙;
求实例,谢谢.XML为:-<PlaceSearchResponse><status>OK</status>-<results>-<result><name>中国银行宣武支...
求实例,谢谢.
XML为:
- <PlaceSearchResponse>
<status>OK</status>
- <results>
- <result>
<name>中国银行宣武支行</name>
- <location>
<lat>39.90533</lat>
<lng>116.390294</lng>
</location>
<address>南新华街1号</address>
<telephone>(010)63017406</telephone>
<tag>银行,虎坊桥</tag>
</result>
- <result>
<name>北京银行灯市口支行</name>
- <location>
<lat>39.92479</lat>
<lng>116.420847</lng>
</location>
<address>北京市东城区灯市口大街50号</address>
<telephone>(010)65266766</telephone>
<tag>银行,王府井/东单</tag>
</result>
- <result>
<name>中国银行东安门支行</name>
- <location>
<lat>39.921911</lat>
<lng>116.416368</lng>
</location>
<address>北京市东城区东安门大街19号 (100006)</address>
<telephone>(010)65132238</telephone>
<tag>银行,王府井/东单</tag>
</result>
</results>
</PlaceSearchResponse>
我想得到这样的数组:
Array
(
[0] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[1] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[2] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[3] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
) 展开
XML为:
- <PlaceSearchResponse>
<status>OK</status>
- <results>
- <result>
<name>中国银行宣武支行</name>
- <location>
<lat>39.90533</lat>
<lng>116.390294</lng>
</location>
<address>南新华街1号</address>
<telephone>(010)63017406</telephone>
<tag>银行,虎坊桥</tag>
</result>
- <result>
<name>北京银行灯市口支行</name>
- <location>
<lat>39.92479</lat>
<lng>116.420847</lng>
</location>
<address>北京市东城区灯市口大街50号</address>
<telephone>(010)65266766</telephone>
<tag>银行,王府井/东单</tag>
</result>
- <result>
<name>中国银行东安门支行</name>
- <location>
<lat>39.921911</lat>
<lng>116.416368</lng>
</location>
<address>北京市东城区东安门大街19号 (100006)</address>
<telephone>(010)65132238</telephone>
<tag>银行,王府井/东单</tag>
</result>
</results>
</PlaceSearchResponse>
我想得到这样的数组:
Array
(
[0] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[1] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[2] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
[3] => Array
(
[name] =>
[lat] =>
[lng] =>
[address] =>
[telephone] =>
[tag] =>
)
) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询