我有一个代码片段来查询Minecraft服务器并获取所有信息,MOTD,状态,在线玩家等。
我从GitHub存储库和示例文件中获取了所需的代码。我将php文件编辑为以下内容:
include_once 'MinecraftServerStatus/status.class.php';
$status = new MinecraftServerStatus();
$response=$status->getStatus('185.38.148.138:25594', '1.7.*', 28028);
if(!$response) {
echo"The Server is offline!";
} else {
echo"<img width=\"64\" height=\"64\" src=\"".$response['favicon']."\" /> <br>
The Server ".$response['hostname']." is running on ".$response['version']." and is online,
currently are ".$response['players']." players online
of a maximum of ".$response['maxplayers'].". The motd of the server is '".$response['motd']."'.
The server has a ping of ".$response['ping']." milliseconds.";
}
?>
问题是当php脚本在hello world文本之上时它没有打印任何东西,当它在它下面时它运行了html但没有从php脚本中回来。
我尝试使用IP代替自定义IP而没有,我不确定我做错了什么。
我的服务器现在在线,所以尝试帮助会很棒!
指向MCServerStatus代码的链接位于:GitHub Link
指向我网站的链接:The Page the PHP script is on
错误如下:include_once 'MinecraftServerStatus/status.class.php';
$status = new MinecraftServerStatus();
$response=$status->getStatus('185.38.148.138:25594', '1.7.*', 28028);
if(!$response) {
echo"The Server is offline!";
} else {
echo"<img width=\"64\" height=\"64\" src=\"".$response['favicon']."\" /> <br>
The Server ".$response['hostname']." is running on ".$response['version']." and is online,
currently are ".$response['players']." players online
of a maximum of ".$response['maxplayers'].". The motd of the server is '".$response['motd']."'.
The server has a ping of ".$response['ping']." milliseconds.";
}
由于