alex.cool / rcon
PHP的简单Rcon类
v1.0.5
2018-10-28 11:35 UTC
This package is auto-updated.
Last update: 2024-09-29 04:49:02 UTC
README
PHP的简单Rcon类。
该项目是从thedudeguy/PHP-Minecraft-Rcon分支出来的。
安装
使用Composer
可以使用以下命令安装此Rcon库
$ composer require alex.cool/rcon
示例
为了让此脚本工作,必须在服务器上启用rcon,通过在服务器的server.properties
文件中设置enable-rcon=true
来实现。还必须设置一个密码,并在脚本中提供。
require_once __DIR__ . '/vendor/autoload.php'; use AlexCool\Rcon\Client\MinecraftClient; $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. $rcon = new MinecraftClient($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->sendCommand("say Hello World!"); }