如何通过 php 从该 xml 文件中获取包含“steamID64”的列表?: http://steamcommunity.com/groups/BillKeyTrading/memberslistxml/?xml=1
这是我当前的代码:
$file = simplexml_load_file('http://steamcommunity.com/groups/BillKeyTrading/memberslistxml/?xml=1
');
foreach ($file->members as $steam){
$steamid64=$steam->steamID64;
echo $steamid64;
}
循环遍历
id
,而不是 member
。您只有 1 名成员。
foreach ($file->members->steamID64 as $steam){
echo $steam . "\n";
}
或者在循环中为每个 id 循环:
foreach ($file->members as $steam){
foreach($steam->steamID64 as $steamid64) {
echo $steamid64 . "\n";
}
}