我试图像这样设置文本我试过显示弹性,绝对位置,弹性方向,向左飘浮,对回声没有任何作用<?php$servers = array('30120' => 1, '30121' => 2, '30122' => 3);foreach ($servers as $key => $value) { $server = json_decode(@file_get_contents("http://xxxxxxxxx:$key/players.json"), true); if ($server) { $players = count($server); $key = "<p style=color:green;>Online</p><p>$players/32"; } else { $key = "<p style=color:red;>Offline</p>"; } echo "<h3>Server $value:</h3>"; echo $key; echo "<br>";}?>
1 回答
红糖糍粑
TA贡献1815条经验 获得超6个赞
您应该将您的物品包装在一个容器中,将容器视为一行,将其中的“服务器”视为水平列。
$servers = array('30120' => 1, '30121' => 2, '30122' => 3);
echo "<div style=\"display:flex;text-align: center\">"; // the row
foreach ($servers as $key => $value) {
$server = json_decode(@file_get_contents("http://xxxxxxxxx:$key/players.json"), true);
if ($server) {
$players = count($server);
$key = "<p style=color:green;>Online</p><p>$players/32";
} else {
$key = "<p style=color:red;>Offline</p>";
}
echo "<div>"; // column
echo "<h3>Server $value:</h3>";
echo $key;
echo "</div>";
}
echo "</div>";
- 1 回答
- 0 关注
- 320 浏览
添加回答
举报
0/150
提交
取消