From 69545500ddcdfbc840c6ab0743f408effca958ed Mon Sep 17 00:00:00 2001 From: tk Date: Tue, 11 Jun 2024 17:05:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Atest=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91?= =?UTF-8?q?=EF=BC=9A=20=E3=80=90=E6=8F=8F=09=E8=BF=B0=E3=80=91=EF=BC=9A=20?= =?UTF-8?q?=09[=E5=8E=9F=E5=9B=A0]=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=A1=B5=E9=9D=A2=20=E5=8E=BB=E6=8E=89compouser?= =?UTF-8?q?=E7=9A=84=E5=BA=93=E5=BC=95=E7=94=A8=20=20=E5=88=A0=E6=8E=89ngi?= =?UTF-8?q?nx=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=94=B9?= =?UTF-8?q?=E7=94=A8apache=20=09[=E8=BF=87=E7=A8=8B]=EF=BC=9A=20=09[?= =?UTF-8?q?=E5=BD=B1=E5=93=8D]=EF=BC=9A=20=E3=80=90=E7=BB=93=09=E6=9D=9F?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- .../Home/Controller/IndexController.class.php | 41 +------------------ nginx.htaccess | 0 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 nginx.htaccess diff --git a/FlyCube/Home/Controller/IndexController.class.php b/FlyCube/Home/Controller/IndexController.class.php index 7a832e5..3508065 100644 --- a/FlyCube/Home/Controller/IndexController.class.php +++ b/FlyCube/Home/Controller/IndexController.class.php @@ -3,50 +3,11 @@ namespace Home\Controller; use Think\Controller; -use PhpMqtt\Client\MqttClient; -use PhpMqtt\Client\Exceptions\MqttClientException; -use PhpMqtt\Client\ConnectionSettings; class IndexController extends Controller { public function index() { - //$this->display(); - $server = 'www.szdot.top'; // MQTT 代理地址 - $port = 1883; // MQTT 代理端口 - $clientId = 'php-mqtt-client'; // 客户端 ID - $username = 'admin'; // 用户名(如果需要) - $password = '123456'; // 密码(如果需要) - - try { - // 创建连接设置对象 - $settings = (new ConnectionSettings) - ->setUsername($username) - ->setPassword($password); - - // 实例化 MQTT 客户端 - $mqtt = new MqttClient($server, $port, $clientId); - - // 连接到 MQTT 代理 - $mqtt->connect($settings); - - // 检查是否连接成功 - if ($mqtt->isConnected()) { - echo "Connected to MQTT broker successfully\n"; - - // 发布消息到指定的主题 - $mqtt->publish('demo', 'Hello MQTT', 0); - - echo "Message published successfully\n"; - - // 断开连接 - $mqtt->disconnect(); - echo "Disconnected from MQTT broker\n"; - } else { - echo "Could not connect to MQTT broker\n"; - } - } catch (MqttClientException $e) { - echo "Could not connect to MQTT broker: " . $e->getMessage(); - } + $this->display(); } } diff --git a/nginx.htaccess b/nginx.htaccess deleted file mode 100644 index e69de29..0000000