微信开发,总是获取token失败

bonlog bonlog 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


$appid = 'wx1aabc8673b8f103a';
$appsecret = '9aa99fc9db9bf1321c1afe05feb29b6c';
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";
$url='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx1aabc8673b8f103a&secret=9aa99fc9db9bf1321c1afe05feb29b6c';


//echo $access_token;

function getDo($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$jsoninfo = json_decode($output, true);

return $jsoninfo;
}

$arr=getDo($url);


$info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$arr["access_token"]}&openid={$appid}&lang=zh_CN";



print_r(getDo($info_url));


其实是能获取token,就是在使用是,就失效了,怎么办啊?
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
bonlog
基础编程 21,889 成员 140,329 内容