微信三方平台开发: https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx通过这个链接,实现成功授权登录!
求PHP Demo

解决方案 »

  1.   

    去官方申请接口,sdk里面有参考例子的demo
      

  2.   

    是jsSDK吗?
      

  3.   

    我的是YIi写的class WxloginController extends Controller{
        public $user_info;//微信账号信息
        public function actionIndex(){
            $class =new wxlogin();
            $redirect_url = "http://域名/wxlogin/callback";
            $state = "STATE";
            $data = $class->get_authorize_url($redirect_url,$state);
        }    public function actionCallback(){
            $class = new wxlogin();
            $code = $_GET['code'];
            if(!$code)
                $this->redirect('/');
            $arr = $class->get_access_token('','',$code);
            if(!$arr)
                $this->redirect('/');
            $userinfo = $class->get_user_info($arr['access_token'],$arr['openid']);//获得微信用户信息
            if(!$userinfo)
                $this->redirect('/');        //nickname,openid,sex,language,city,province,country,headimageurl,微信用户参数
          
                //echo "<script>alert('您使用微信账号登陆成功!');window.location.href='/'</script>";
        }wxlogin这个类 就是企鹅提供的SDK类 改$app_id,$app_secret即可
      

  4.   

    将new wxlogin(); 换成Component更好 直接Yii::app()->wxlogin调用