首頁 >後端開發 >php教程 >一个解析XML的有关问题,多谢

一个解析XML的有关问题,多谢

WBOY
WBOY原創
2016-06-13 10:24:52832瀏覽

请教大家一个解析XML的问题,谢谢

XML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> <alipay>  <is_success>T</is_success>  <request>    <param name="partner">2088002007***    <param name="logistics_name">天天    <param name="create_transport_type">EMS    <param name="trade_no">2008040902***    <param name="agent">20880020070***    <param name="notify_url">      http://10.2.5.100/api/apireceive/returnSuccess.php      <param name="invoice_no">3455**      <param name="service">send_goods_confirm_by_platform      <param name="_input_charset">utf-8      <param name="transport_type">EMS      <param name="return_url">http://10.2.5.100/api/returnResultList.php    </request>  <response>    <tradebase>      <buyer_account>2088002007301423***</buyer_account>      <buyer_actions>[REFUND,CONFIRM_GOODS]</buyer_actions>      <buyer_login_email>***</buyer_login_email>      <buyer_type>PRIVATE_ACCOUNT</buyer_type>      <buyer_user_id>2088002007****</buyer_user_id>      <channel>interface/digi***</channel>      <create_time>2008-04-09       16:10:25</create_time>      <currency>156</currency>      <gathering_type>1</gathering_type>      <last_modified_time>2008-04-10 14:35:25</last_modified_time>      <operator_role>B</operator_role>      <out_trade_no>123455666***</out_trade_no>      <partner_id>2088002007***6</partner_id>      <seller_account>208800200730***156</seller_account>      <seller_actions>[EXTEND_TIMEOUT]</seller_actions>      <seller_login_email>song_xia**hoo.com.cn</seller_login_email>      <seller_type>PRIVATE**OUNT</seller_type>      <seller_user_id>208800**301410</seller_user_id>      <service_fee>0.00</service_fee>      <service_fee_ratio>0.0</service_fee_ratio>      <stop_timeout>F</stop_timeout>      <total_fee>2.00</total_fee>      <trade_from>INST_P**ER</trade_from>      <trade_no>2008040**81748</trade_no>      <trade_status>WAIT_BUYER_CONFIRM_GOODS</trade_status>      <trade_type>S</trade_type>    </tradebase>  </response>  <sign>eb07c7407baf*****0804751a21c1e</sign>  <sign_type>MD5</sign_type></alipay>


我想获取alipay下的is_success节点的值 。 
我是的代码是这样写的
$message=$doc->getElementsByTagName("alipay")->item(0)->nodeValue;
但是好像获取的值不对。 请教下大家如何获取这个值了。 谢谢

------解决方案--------------------
$message=$doc->getElementsByTagName("is_success")->item(0)->nodeValue;
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn