小程序 之客服消息

一、效果图

 二、代码示例

require DT_ROOT . '/api/a/wx.php';
$wx = new wx($db);
$wx_small = $db->get_one("select * from {$DT_PRE}wx_small_user where username='{$username}'");
if ($wx_small['openid']) {
    $data = array(
        'touser' => $wx_small['openid'],
        'msgtype' => 'text',
        'text' => array(
            'content' => $content
        )
    );
    $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$wx->access_token;
    $result = $wx->curl_request($url, json_encode($data), 'post');
    var_dump($result);
}

 

posted @ 2021-05-11 10:38  样子2018  阅读(116)  评论(0编辑  收藏  举报