drsfgwuw61488 2016-09-12 07:59
浏览 95

XML插入变量PHP

i have variable $result contains the xml string as below:

<reversegeocode timestamp="Mon, 12 Sep 16 07:52:44 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="format=xml&lat=30&lon=-95&addressdetails=1">
<result place_id="60369529" osm_type="way" osm_id="21077989" ref="County Road 6042" lat="30.0103064" lon="-95.0042308" boundingbox="30.0030833,30.0158095,-95.005969,-95.0038698">
County Road 6042, Sheeks, Liberty County, Texas, 77336, United States of America
</result>
<addressparts>
<road>County Road 6042</road>
<hamlet>Sheeks</hamlet>
<county>Liberty County</county>
<state>Texas</state>
<postcode>77336</postcode>
<country>United States of America</country>
<country_code>us</country_code>
</addressparts>
</reversegeocode>

I am new in PHP need to insert into variables city (if city not exist city= county), state and zip code tags only which is under <addressparts> tag. All rest data can be ignored. I don't know how to do it

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器