多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
>[info] 客服消息内容结构请参考[微信开发文档](http://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html) ## 发送客服文本消息 ### 操作步骤 ### #1、获取微信SDK操作对象 ``` $wechatObj = get_wechat_obj(); ``` ### #2、组织要发送的文本内容 ``` $customData = array( 'touser' => $openid, 'msgtype' => 'text', 'text' => array( 'content' => '这是一条客服文本消息' ) ); ``` ### #3、发送文本消息 ``` $res = $wechatObj->sendCustomMessage($customData); ``` >[info] 你可以打印出$res来获取客服消息发送结果。 ### 代码示例 ``` // 发送客服消息 $customData = array( 'touser' => $openid, 'msgtype' => 'text', 'text' => array( 'content' => '这是一条客服文本消息' ) ); $res = $wechatObj->sendCustomMessage($customData); var_dump($res); ``` ### 结果示例: ![](https://box.kancloud.cn/8c75c81e9e057c2167ed7a0a31f7db6e_411x415.png)