微信开发预览接口

群发消息接口——第1步:预览接口
1.意义:为了防止开发者模式下,每月发送4条消息的限制,从而导致不满意消息的效果现象。
2.代码实现
  • 纯文本
function sendMsgAll(){
//1.获取全局access_token
$access_token = $this->getWxAccessToken();
//2.组装群发预览接口数据 array
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=".$access_token;
$array =array(
'touser'=> 'oCKD7wXoAmrhBVcVNflyPDEuin8Y', //openid
'text' => array('content' => '旭日养老'), //文本内容
'msgtype' => 'text' //格式
);
//3.将数组转成json格式
$postJson = json_encode ( $array );
//4.调用第三方接口
$res = $this->https_request( $url ,'post', 'json',$postJson);
dump($res);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值