zoukankan      html  css  js  c++  java
  • 微信开发 获取用户openId 与路由控制

    w实践,满足当前需求。

    www.w.com

    www.w.com/w1.php

    $wxurl='https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$wxwid.'&redirect_uri=http://www.w.com/woauth2.php&response_type=code&scope=snsapi_base&state=1#wechat_redirect';
    header('Location: '.$wxurl);

    www.w.com/woauth2.php

    $wxurl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$wxwid
        .'&secret='.$wxws;
    
    $wxr_code = $_REQUEST['code'];
    
    $wxurl='https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$wxwid
        .'&secret='.$wxws.'&code='.$wxr_code.'&grant_type=authorization_code';
    $result = file_get_contents($wxurl);
    $res =json_decode($result, true);
    var_dump($res);
    $wxr_openid=$res['openid'];
    var_dump($wxr_openid);
  • 相关阅读:
    Design Tutorial: Inverse the Problem
    The Number Off of FFF
    "Money, Money, Money"
    No Pain No Game
    Group
    Vases and Flowers
    Codeforces Round #466 (Div. 2)
    ST表
    Wildcard Matching
    HDOJ 3549 Dinitz
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6441537.html
Copyright © 2011-2022 走看看