公众号有些用户存在跳转页面不正常

一个公号号,不同的用户,在点击同一个按钮会跳转到不同的页面。
跳转正确的是没有问题的,但是不正确的跳转像是发生了没有获取到openid从而强制跳转的。

public function __construct()
{

    $openid = Session::get('openid');
    if($openid){
        $par_stu = new ParStu();
        $res = $par_stu->where('openid',$openid)->count();
        if($res){

        }else{
            redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
        }
    }else{
        WeChat::getOpenid();
    }
}

这些是关于获取openid和强制跳转的代码。
并且只有这一个页面有问题,别的页面跳转都正常
阅读 1.4k
1 个回答

public function __construct()

{
    // old Code
    // $openid = Session::get('openid');
    // if($openid){
    //     $par_stu = new ParStu();
    //     $res = $par_stu->where('openid',$openid)->count();
    //     if($res){

    //     }else{
    //         redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
    //     }
    // }else{
    //     WeChat::getOpenid();
    // }

    // new Code
    if(Session::has('openid')){
        $openid = Session::get('openid');
        $binding = new Bindings();
        $res = $binding->where('openid',$openid)->count();
        if($res){

        }else{
            redirect('http://zhbxsq.jiazhouedu.com.cn/binding')->send();
        }
    }else{
        WeChat::getOpenid();
    }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题