我敢肯定我的标题并没有那么有帮助。我想要做的是,我有一个包含名字的数组。我还有一个动态数组,它是使用来自外部 xml 文件的 foreach 生成的。我想要做的是,如果找到一个名称,然后将每个名称都回显出来。我仍在研究我的 PHP 技能,但我不知道该怎么做才能让它按照我想要的方式工作。我已经搜索了几个小时试图找到一些可行但没有的东西。我可能搜索不正确。
这是我正在尝试做的代码。
// This just gets how many players ore on the US team
$serverplayer = $gameME_sdk_object->client_api_serverinfo("".$ip."/players/usarmy");
foreach($serverplayer['serverinfo'][0]['teams'] as $mainserver) {
if($mainserver['name'] == "usarmy") {
$dacount = $mainserver['count'];
}
}
if($dacount >= 1)
// Begins Admin List/Count
$admins = array("INFIDEL_HARE", "Romania191", "mardog104", "INFIDEL_JIHAD", "stvnsng", "HellKnightFire", "McThump", "INFIDEL_JByrns93", "INFIDEL_ALPHA", "s0ck37", "Zepppster", "xRingmasteressx", "FreeeKillz", "smokert", "Ccls2", "INFIDEL_GRIF", "cuzco2585", "Prophet731", "KittensDrunk", "Rexperience-EF", "Whickerbasket", "InfamousHoole", "Cruz_5326", "-Grimreaperx9-", "JoeyT2");
foreach($serverplayer['serverinfo'][0]['players'] as $admname) {
$Alist[] = $admname['name'];
if(in_array($Alist, $admins)) {
$adminlist = $admname['name'];
$countAlist = count($adminlist);
}
}
// Ends Admin List/Count
// Everything below is just the data
echo '<div class="four-columns six-columns-tablet twelve-columns-mobile">';
echo '<pre>';
echo $adminlist;
echo '</pre>';
echo "<div class=\"table-header\">US (".$dacount.")</div>";
echo '<table class="table responsive-table" id="scoreboard">';
echo '<thead>';
echo '<tr>';
echo '<th scope="col" width="2%">Sq</th>
<th scope="col">Name</th>
<th scope="col" width="2%">K</th>
<th scope="col" width="2%">D</th>
<th scope="col" width="5%" class="hide-on-mobile hide-on-tablet hide-on-mobile-portrait">Cheat Meter</th>';
echo '</tr></thead>';
echo '<tbody>';
foreach($serverplayer['serverinfo'][0]['players'] as $player) {
echo '<tr>';
if ($player['team'] == "unassigned" Xor $player['team'] == "None") {
$team = "<small class=\"tag green-gradient glossy\">Joining</small>";
}
echo "<td class=\"low-padding\">".ucfirst($player['squad'])."</td>";
echo "<td class=\"low-padding\"><a href=\"http://battlelog.battlefield.com/bf3/user/".$player['name']."\" target=\"_blank\"><img src=\"./img/battlelog.png\" alt=\"Battlelog Profile\" width=\"16\" height=\"16\"></a> ".$player['name']."<span style=\"float: right\">".$team."</span></th>";
echo '<td>'.$player['kills'].'</td>';
echo '<td>'.$player['deaths'].'</td>';
echo "<td><a href=\"http://panel.dev.adkgamers.com/?p=" . $player['name'] . "&id=cheatometer\"target=\"_blank\">Check</a></td>";
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
我该怎么做呢?如果有人知道如何或理解我想要做什么。