回显xml标签有问题
PHP:$xml = $insureFormResult->returned;
$xml1 = new SimpleXMLElement($xml);
$result = $xml1->xpath("response")[0];
echo $result;
如果我回显$xml它会给我:
<?xml version="1.0" encoding="utf-8"?>
<response>
<errors>
<error code="7">Your details are already in our system and have been forwarded to our insurance partners who will contact you shortly</error>
</errors>
</response>
xml将始终有一个响应标记。我还想知道如何与id 'code'回显标签。我尝试了上面的php,但是没有返回结果。
任何形式的帮助将不胜感激!
编辑
由于我的服务器上的PHP版本,它不能工作。
我不太熟悉PHP,但是xpath访问带有值7
的属性code
的错误是:
/response/errors/error[@code='7']