2012-04-25 3 views
0

나를 괴롭히는 사람 - 나는 단순한 XML 요소를 가지고 있으며 '_Code'특성 만 추출하려고합니다. 나는 그것을 어떻게 할 것이냐?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

답변