在 $worker = new Worker(); 里面創(chuàng)建兩個
$mqtt = new Workerman\Mqtt\Client()
$mqtt_to = new Workerman\Mqtt\Client()
導致錯誤
Warning: Cannot declare class \Workerman\Protocols\Mqtt, because the name is already in use in E:\iot_gateway\vendor\workerman\mqtt\src\Client.php
on line 185
怎么解決呢? 謝謝您
$mqtt = new Workerman\Mqtt\Client('*********', $options);
$mqtt->onConnect = function() use ($mqtt, $file_name) {
$mqtt->subscribe('/001/+/+');
};
$mqtt_to = new Workerman\Mqtt\Client('**********', $options_to);
$mqtt_to->onConnect = function() use ($mqtt_to, $file_name) {
//$mqtt_to->subscribe('/001/+/+');
};