# msg **Repository Path**: zhenzihan/msg ## Basic Information - **Project Name**: msg - **Description**: workman socket - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-11-12 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 下载安装 ====== 1、git clone https://gitee.com/zhenzihan/msg.git 2、composer install 后端服务启动停止 ====== ## Linux系统 ### 启动服务 php start.php start -d ### 停止服务 php start.php stop ### 服务状态 php start.php status ## windows系统 双击start_for_win.bat 如果启动不成功请参考 [Workerman手册](http://doc3.workerman.net/install/requirement.html) 配置环境 前端代码类似:web/index.html ==== ```javascript // 引入前端文件 ``` 后端调用api向任意用户推送数据 web/push.php ==== ```php 'publish', 'content' => '这个是推送的测试数据', 'to' => $to_uid, ); $ch = curl_init (); curl_setopt ( $ch, CURLOPT_URL, $push_api_url ); curl_setopt ( $ch, CURLOPT_POST, 1 ); curl_setopt ( $ch, CURLOPT_HEADER, 0 ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data ); $return = curl_exec ( $ch ); curl_close ( $ch ); var_export($return); ``` 常见问题: ==== 如果通信不成功检查防火墙 /sbin/iptables -I INPUT -p tcp --dport 2120 -j ACCEPT /sbin/iptables -I INPUT -p tcp --dport 2121 -j ACCEPT /sbin/iptables -I INPUT -p tcp --dport 2123 -j ACCEPT workerman相关参见 [www.workerman.net](http://www.workerman.net/)