zoukankan      html  css  js  c++  java
  • 获取openid [微信小程序]

      public function wxapi(){
            $data=$this->requestdata();
            if(!$data['code']) exit(json_encode(array('status'=>-1,'msg'=>'参数异常')));
            $paymentPlugin = M('Plugin')->where("code='weixin' and  type = 'payment' ")->find(); // 找到微信支付插件的配置
            $config_value = unserialize($paymentPlugin['config_value']); // 配置反序列化
            $appid = $config_value['appid']; // * APPID:绑定支付的APPID(必须配置,开户邮件中可查看)
            $mchid = $config_value['mchid']; // * MCHID:商户号(必须配置,开户邮件中可查看)
            $key = $config_value['key']; // KEY:商户支付密钥,参考开户邮件设置(必须配置,登录商户平台自行设置)
            $appsecret = $config_value['appsecret']; // 公众帐号secert(仅JSAPI支付的时候需要配置),
            $url = "https://api.weixin.qq.com/sns/jscode2session?appid=$appid&secret=$appsecret&grant_type=authorization_code&js_code=";
            $json=file_get_contents($url.$data["code"]);
            //$res = json_decode($res, true);
            $jsoarray = json_decode($json, true);
    
            exit(json_encode(array('status'=>1,'msg'=>'访问成功',"result"=>$jsoarray)));
        }
    

      code 微信小程序 wx.login获取到的

  • 相关阅读:
    验证SMTP工作过程
    FileZilla FTP服务器的安装和配置
    最后一块石头的重量
    不用加号的加法
    同构字符串
    最长公共子序列
    Telnet 验证HTTP工作过程
    矩阵的最小路径和
    子数组的最大累加和问题
    海思开发板——YOLOv3模型移植(4)
  • 原文地址:https://www.cnblogs.com/xqschool/p/9530281.html
Copyright © 2011-2022 走看看