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);

 

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-09-23
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-10-31
  • 2021-07-20
相关资源
相似解决方案