//创建一个函数来获取access_token的函数方法
public function get_acctoken(){
//获取access_token的appid与appsecret
$appid="wx66c8decc0ee6d957";
$appsecret="d4624c36b6795d1d99dcf0547af5443d";
//获取access_token的url
$at_url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret;
//利用函数file_get_contents获取access_token
$info=file_get_contents($at_url);
//利用json_decode把返回的字符串对象化
$info=json_decode($info);
//返回access_token
return $info->access_token;
}
微信开发的access_token的获取
最新推荐文章于 2023-04-24 15:36:54 发布