本文整理汇总了PHP中Server::getServerList方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getServerList方法的具体用法?PHP Server::getServerList怎么用?PHP Server::getServerList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::getServerList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateCSV
function GenerateCSV()
{
$servers = Server::getServerList();
$output = "";
foreach ($servers as $s) {
//Write server values into a line (separated by tabs)
$output .= $s->getPublicKey() . "\t";
$output .= $s->getName() . "\t";
$output .= $s->getMotd() . "\t";
$output .= $s->getPort() . "\t";
$output .= $s->getAddress() . "\t";
$output .= $s->getVersion() . "\t";
$output .= $s->getUserCount() . "\t";
$output .= $s->getMaxClients() . "\t";
$output .= $s->getGameMode() . "\t";
$output .= $s->getUserList() . "\n";
//Terminate server entry using line break
}
return $output;
}
示例2: DateTime
</div>
<?php
}
?>
<h1 class="is-center">Manic Digger Online Servers</h1>
<div class="pure-g serverlist">
<?php
require_once "classes/Utility.php";
require_once "classes/Server.php";
$loggedIn = false;
$username = null;
if (isset($_SESSION["user_name"])) {
$username = $_SESSION["user_name"];
$loggedIn = true;
}
$servers = Server::getServerList();
$now = new DateTime();
foreach ($servers as $s) {
$link = "md://" . htmlspecialchars($s->getAddress()) . ":" . htmlspecialchars($s->getPort()) . "/?";
if ($loggedIn) {
$link .= "user=" . urlencode($username) . "&auth=" . urlencode(md5($s->getPrivateKey() . $username)) . "&";
}
$link .= "serverPassword=" . $s->getPasswordProtected();
$heartbeat = new DateTime($s->getLastHeartbeatDate());
$dateDiff = $now->diff($heartbeat);
$timeDiff = $now->getTimestamp() - $heartbeat->getTimestamp();
$offline = false;
if ($timeDiff > 300) {
$offline = true;
}
?>
示例3: assignVariables
public function assignVariables()
{
parent::assignVariables();
WCF::getTPL()->assign('serverList', Server::getServerList());
}
示例4: readData
/**
* @see Page::readData()
*/
public function readData()
{
parent::readData();
$this->serverList = Server::getServerList();
}