我还有一个问题。
当我尝试从以下 php 类获取数据时出现内部服务器错误:
<?php
/**
* Created by JetBrains PhpStorm.
* User: -Ryuk-
* Date: 21/11/12
* Time: 17:08
* To change this template use File | Settings | File Templates.
*/
class game
{
private $_serverStatus = "Online";
private $_numOnline = "32";
private $_maxPlayers = "50";
private $_messageOfTheDay = "Welcome to game!";
private $_Players = "Falcubar2011;Zacardor;";
public function GetStatus()
{
return this::$_serverStatus;
}
public function GetNumOnline()
{
return this::$_numOnline;
}
public function MaxPlayers()
{
return this::$_maxPlayers;
}
public function GetMOTD()
{
return this::$_messageOfTheDay;
}
public function GetPlayers()
{
return this::$_Players;
}
public function GetServiceColour()
{
if(this::GetStatus() != "Online")
return "#FF0000";
else
return "#008000";
}
}
我试图这样称呼它(在 index.php 中)我把它去掉了,所以你不会得到所有的垃圾。
$mc = new game();
<div id="Stats">
<div id=roundedbox>
<h1>Info</h1>
<p>
<p><strong>IP:</strong> play.game.com</p>
<br>
<p>Slots: <?php print $mc->GetNumOnline(); ?> / <?php print $mc->MaxPlayers(); ?></p>
<br>
<p>Status: <?php print $mc->GetStatus(); ?></p>
<br>
<p>MOTD: <?php print $mc->GetMOTD(); ?></p>
</div>
</div>
任何人都知道如何解决我遇到的这个问题?