PHP-SimpleXMLElement-如何访问此元素

PHP-SimpleXMLElement-如何访问此元素,php,simplexml,Php,Simplexml,我正在尝试访问SimpleXMLElement“数组”中的元素 我的XML如下所示: 使用simplexml\u load\u string()加载它会得到以下var\u dump结果: object(simplexmlement)#40(1){ [“更改”]=> 阵列(16){ [0]=> 对象(simplexmlement)#39(1){ [“@attributes”]=> 阵列(1){ [“应用程序版本”]=> 字符串(5)“01.16” } } [1]=> 对象(simplexmle

我正在尝试访问SimpleXMLElement“数组”中的元素

我的XML如下所示:


使用
simplexml\u load\u string()
加载它会得到以下var\u dump结果:

object(simplexmlement)#40(1){
[“更改”]=>
阵列(16){
[0]=>
对象(simplexmlement)#39(1){
[“@attributes”]=>
阵列(1){
[“应用程序版本”]=>
字符串(5)“01.16”
}
}
[1]=>
对象(simplexmlement)#41(1){
[“@attributes”]=>
阵列(1){
[“应用程序版本”]=>
字符串(5)“01.15”
}
}
[2]=>
对象(simplexmlement)#42(1){
[“@attributes”]=>
阵列(1){
[“应用程序版本”]=>
字符串(5)“01.14”
}
}
}
如何访问我想要的内容的
changes
条目

例如,我该如何做:

echo $xml->changes['01.16'];
希望它输出第一个条目内容(
微小的界面更改…
)?

尝试以下操作:

$string = <<<XML
[your xml above]
XML;

$xml = simplexml_load_string($string);
$results = $xml->xpath('.//changes[@app_ver="01.16"]'); 
echo (trim($results[0]));
Minor interface changes
          
          Please visit http://community.wbgames.com/t5/Mortal-Kombat-X/ct-p/MKX for more details.