1:判断是否关注
<body onload="load()">//载入完毕后执行load子程序
<script>
function load(){
if('{$_W['fans']['follow']}'==0){
//判断是否关注当前公众号
//mui.alert('老铁,没关注啊')
$(".wb-box").show(); //弹出二维码
}
</script>
2:获得场景二维码
public function doMobiletest(){
global $_GPC, $_W;
$barcode = array(
'expire_seconds' => 2592000,
'action_name' => 'QR_SCENE',
'action_info' => array(
'scene' => array(
'scene_id' => 123
),
),
);
$account_api = WeAccount::create();
$result = $account_api->barCodeCreateDisposable($barcode); //微擎函数:获得场景二维码
// 微擎官方文档:http://s.w7.cc/index.php?c=wiki&do=view&id=1&list=1013
return $result[ticket];
//https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=TICKET 换取二维码
}
3:弹出二维码前端代码
(有亢余代码)
参考:https://www.jianshu.com/p/16b0f0ce0ee0(主要)
https://www.cnblogs.com/swack/p/5015003.html
https://www.cnblogs.com/swack/p/5015003.html
div部分
<!--弹窗div------------------