您的位置:首页 > 移动开发 > 微信开发

微信开发预览接口

2016-11-03 14:22 176 查看
群发消息接口——第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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php