-1
有不知道的IM應該如何把標題,但這裏是代碼:字符串不會放棄任何東西從JSON
if(isset($stats->playerStatus->server->serverIPv6Address)){ // prefer the IPv6 address if it's there`
$srvDetails = file_get_contents('https://api.kag2d.com/server/ip/' . $stats->playerStatus->server->serverIPv6Address . '/port/' . $stats->playerStatus->server->serverPort . '/status');
}elseif(isset($stats->playerStatus->server->serverIPv4Address)){
$srvDetails = file_get_contents('https://api.kag2d.com/server/ip/' . $stats->playerStatus->server->serverIPv4Address . '/port/' . $stats->playerStatus->server->serverPort . '/status');
}
$srvContent = json_decode($srvDetails, true);
$srvName = $srvContent->serverName;
$playerString = 'Players: ' . $srvContent->currentPlayers . '/' . $srvContent->maxPlayers;
和$ srvName保持空並且$ playerString只是玩家:/ 起飛以https://api.kag2d.com/server/ip/199.168.184.8/port/23002/status爲例 謝謝
沒有工作。 「 – Mazey
」不起作用「是沒有錯誤的描述。 – Sven
字符串是完全一樣的,仍然是空的 – Mazey