微信发送图文消息代码整理
这个就不多说什么了, 下单成功后微信提示图文消息.核心代码如下
if(!empty($openid)){
$wxinfo=curlgetcontents(“https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}”);
$wxinfo= json_decode($wxinfo);
$data='{
“touser”:”‘.$openid.'”,
“msgtype”:”news”,
“news”:{
“articles”: [
{
“title”:”订单完成”,
“description”:”‘.$contentStr.'”,
“url”:””
}
]
}
}’;
curlgetcontents(‘https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=’.$wxinfo->access_token,$data);
}
标签:PHP