public function sendall(){
$all_openid=$this->tosendall();
foreach($all_openid as $value){
$this->set_msg($value);
}
}
public function tosendall(){
$access_token=$this->getAccesstoken();
$url="https://api.weixin.qq.com/cgi-bin/user/get?access_token={$access_token}&next_openid=";
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$data=curl_exec($ch);
$data=json_decode($data,true);
return $data['data']['openid'];
}
public function set_msg($openid){
$access_token = $this->getAccesstoken();
$template = array(
"touser" => "$openid",//用户openid
"template_id" => "-dRb-6prGX6AO6Pt_uTirmH2fztkVHLFG7HHfISwjXg",//模板id
"url" => "",//跳转链接
php微信公众号模版消息发送(群发)
最新推荐文章于 2024-08-31 08:33:09 发布