<?php

$appid = "wx200ece2d613cc414"; //这里的appid是假的演示用

$redirect_uri = urlencode("http://test.it1000.cc/test.php"); //这里的地址需要http:

$url = "https://open.weixin.qq.com/connect/oauth2/authorize?app>;
header('location:' . $url);
<?php

$appid         = "wx200ece2d613cc414";
$secret        = "029daa7ef07c36c4e3b97673f5713d76";
$code          = $_GET["code"];
$get_token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $secret . '&code=' . $code . '&grant_type=authorization_code';
$ch            = curl_init();
curl_setopt($ch, CURLOPT_URL, $get_token_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$res = curl_exec($ch);
curl_close($ch);
$json_obj = json_decode($res, true);
var_dump(json_obj);

这个简易版

相关文章:

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