有人可以帮我从xPaw的这个Minecraft查询中获取主机名。
这是回购:https://github.com/xPaw/PHP-Minecraft-Query
我相信我在GetInfo()之后添加了一些东西。
<?php
require('MinecraftQuery.class.php');
$Query = new MinecraftQuery( );
try
{
$Query->Connect( 'localhost', 25565 );
print_r( $Query->GetInfo( ));
}
catch( MinecraftQueryException $e )
{
echo $e->getMessage( );
}
?>
看看https://github.com/xPaw/PHP-Minecraft-Query/blob/master/MinecraftQuery.class.php#L105,你应该能够: -
$info = $Query->GetInfo();
echo $info['hostname'];