0
私は簡単なXML要素を持っています。「_コード」属性を抽出したいだけです。どうすればいい?PHPの単純なXML要素の属性を抽出する
<?php
$responseCode = "<STATUS _Condition='FAILURE' _Code='0705' _Description='Search failed subject not found' />";
$xml = simplexml_load_string($responseCode);
print_r($xml);
$code = $xml=>@attributes=>_Code; // Parse error
$code = $xml['@attributes']['_Code']; // Returns blank
echo "CODE = ".(string)$code;
?>
CODE =
http://php.net/manual/en/function.simplexml-load-string.php