【发布时间】:2012-02-21 06:46:53
【问题描述】:
这是来自 WSDL 的响应
<return code='6000'></return>
我想返回代码值。我可以使用simplexml_load_string() 吗?
【问题讨论】:
这是来自 WSDL 的响应
<return code='6000'></return>
我想返回代码值。我可以使用simplexml_load_string() 吗?
【问题讨论】:
【讨论】:
您可以使用 DOMDocument() 来获取节点值以及属性值。
$dom_boj=new DOMDocument(); //Creating object to the class DOMDocument()
$dom_boj->loadXML($XMLResponse); // loading your response using loadXML
//Traversing all return tags.
foreach($dom_boj->getElementByTagName('return') as $tagName)
{
echo $tagName->getAttribute('code');
}
【讨论】: