为了方便给关注公众号的粉丝分组,我们可以生成带参数的二维码并给粉丝打标签,带参数的二维码分为临时和永久两种。
下面是我的代码。调用了createTag方法,传递场景值字符串参数,并调用了createTicket方法,传递三个参数,分别为类型,有效期,场景值字符串,最后将数据写入数据库。
- if(IS_GET){
- $this->display('qrcode_add');
- }else{
- $mp = $this->mp;
- $arr = I('post.');
- $arr['mp_id'] = $mp['id'];
- $id = M('qrcode')->add($arr);
- // echo $id;
- // exit;
- $this->createTag($arr['scene_str']);
- include APP_PATH . 'LaneWeChat/lanewechat.php';