我是靠谱客的博主 小巧蜡烛,这篇文章主要介绍微信公众号——创建标签,给粉丝打标签。,现在分享给大家,希望可以做个参考。

1.创建标签

public function createTag($tag=''){
// 查库,是否有,没有创建,把tag和tag_id写到库中
$mp = $this->mp;
$tagname = "11";
$where['mp_id'] = $mp['id'];
$where['tag'] = $tagname;
$data = M('mp_tags')->where($where)->find();
if(empty($data)){
$api = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token=" . getAccess_token();
$arr = array();
$arr['tag']['name'] = $tagname;
$json = json_encode($arr,JSON_UNESCAPED_UNICODE);
// dump($json);
// exit();
include APP_PATH . 'LaneWeChat/lanewechat.php';
$ret = LaneWeChatCoreCurl::callWebServer($api,$json,'POST');
// dump($ret);
// exit();
if ($ret['tag']) {
$row['mp_id'] = $mp['id'];
$row['tag_id'] = $ret['tag']['id'];
$row['tag'] = $ret['tag']['name'];
M('mp_tags')->add($row);
}
}
}

2.给粉丝打标签

public function openidTag(){
// $openid = "o7RZ_0Z-9OLCKEQ0PNEh5fr8neDc";
$openid = "o7RZ_0aaxcPh23BG2l-DUxHxN9J8";
$api = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=" . getAccess_token();
// $arr = array();
$arr['openid_list'] = array($openid);
$arr['tagid'] = 111;
$json = json_encode($arr);
// dump($json);
// exit;
include APP_PATH . 'LaneWeChat/lanewechat.php';
$ret = LaneWeChatCoreCurl::callWebServer($api,$json,'POST');
print_r($ret);
}

最后

以上就是小巧蜡烛最近收集整理的关于微信公众号——创建标签,给粉丝打标签。的全部内容,更多相关微信公众号——创建标签内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部