我不知道该怎么做因为我不太了解PHP,但我想做这件事,我有这个HTML代码:
<td class="servers" id="online">EXAMPLE ONLINE / OFFLINE FROM PHP</td>
我想放入&lt; td&gt;标记服务器状态ONLINE / OFFLINE我将从我的PHP代码中获得:
<?php
//Load Framework
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
try {
//Connect
$ts3 = TeamSpeak3::factory("serverquery://serveradmin:querypassword@ts3.domain:10011/?server_port=9987");
//Server Status
echo "ONLINE";
}
catch(Exception $e) {
//Errors (No connection)
echo "OFFLINE";
}
?>
怎么做,请帮忙。
答案 0 :(得分:0)
<?php
//Load Framework
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
try {
//Connect
$ts3 = TeamSpeak3::factory("serverquery://serveradmin:querypassword@ts3.domain:10011/?server_port=9987");
//Server Status
$result = "ONLINE";
}
catch(Exception $e) {
//Errors (No connection)
$result = "OFFLINE";
}
echo "<td class='servers' id='$result'>$result</td>";
?>