1 在thinkphp根目錄建立檔案夾 (這裡我建立的是Workerman)
2 去workerMan官網下載下傳最新版的 GtewayWorker
3 把下載下傳好的 GtewayWorker裡的所有檔案 放入Workerman檔案夾下,進入Applications/YourApp/ 配置你的伺服器資訊以及端口,
編輯 start_gateway.php
編輯 start_businessworker.php
編輯 start_register.php
編輯Events.php,對用戶端發送$client_id
4 啟動start.php (php start.php start)
5 在前台頁面寫入
6 下載下傳 Gateway.php,https://github.com/walkor/GatewayClient,下載下傳之後放入 /ThinkPHP/Library/Org/Util/
7 建立Index控制器,在頭部引用 use Org\Util\Gateway;
8 建立binding方法,用于client_id 與群組綁定
9 在Index控制器 建立對群組發送消息的方法 sendMessage
更詳細的Workerman使用方法 可以進入Workerman官網進行檢視