zoukankan      html  css  js  c++  java
  • 微信

    ——————————微信公从号授权
     $code = input('code');
                
                if($code != ''){
                    $url "https://api.weixin.qq.com/sns/oauth2/access_token?appid=".config('appid')."&secret=".config('appsecret')."&code=$code&grant_type=authorization_code";
                    $result = https_request($url);
                    $jsoninfo = json_decode($result, true);
                    if(!empty($jsoninfo['openid'])){
                        $openid $jsoninfo['openid'];
                        cookie('openid',$openid,1000);
                        $res $this->up_user_info($openid,$jsoninfo['access_token']);
                    }
                }
                if (cookie('openid') == '') {
                    $url 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
                    $url2 = urlencode($url);
                    header("Location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=".config('appid')."&redirect_uri=".$url2."&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect");
                    exit;
                }
  • 相关阅读:
    shell & awk 变量传递
    ubuntu下SVN服务器安装配置
    zabbix客户端配置
    python操作Excel读写--使用xlrd
    Zabbix Agent-Windows平台配置指导
    centos6.5下Zabbix系列之Zabbix安装搭建及汉化
    Centos 下安装Zabbix Linux 客户端
    zabbix监控mysql主从复制
    Zabbix利用msmtp+mutt发送邮件报警
    vue props传数组爬坑
  • 原文地址:https://www.cnblogs.com/csjoz/p/7244025.html
Copyright © 2011-2022 走看看