微信公众号开发-对指定用户发送客服消息

流程

获取到用户openid 调用api就可发送消息

代码

消息发送页面

<?php
    include './wxz.php';

    if($_POST['msg']){
    
    
        $openid = $_POST['openid'];
        $msg = $_POST['msg'];
        (new Wxz())->kefuMsg($openid, $msg);
    }
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>客服消息</title>
</head>
<body>
    <form action="" method="post">
        <input type="text" name="openid" value="oLSiH5oWuR5RrpJ5P64sOqrsHRtU" id="">
        <input type="text" name="msg" id="">
        <input type="submit" value="发送消息">
    </form>
</body>
</html>

db.php 与 wxz.php 见

https://blog.csdn.net/weixin_42043407/article/details/116905422
https://blog.csdn.net/weixin_42043407/article/details/116905455

おすすめ

転載: blog.csdn.net/weixin_42043407/article/details/116905567