thedudeguy / rcon
简单的PHP Rcon类。
v1.0.0
2017-05-25 06:50 UTC
This package is not auto-updated.
Last update: 2024-09-15 03:49:49 UTC
README
简单的PHP Rcon类。
安装
使用Composer
可以使用以下命令安装此Rcon库
$ composer require thedudeguy/rcon
不使用Composer
如果未使用Composer,只需将Rcon.php文件放置到您的项目中,并在PHP脚本中包含它
require_once('Rcon.php');
示例
要使此脚本正常工作,服务器上必须启用rcon,通过在服务器的server.properties文件中设置enable-rcon=true。还必须设置一个密码,并在脚本中提供。
$host = 'some.minecraftserver.com'; // Server host name or IP $port = 25575; // Port rcon is listening on $password = 'server-rcon-password'; // rcon.password setting set in server.properties $timeout = 3; // How long to timeout. use Thedudeguy\Rcon; $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->sendCommand("say Hello World!"); }