微信获得access_token

<?php
//获取access_token
$appid = ‘wx47a6fc3c1187e60d‘; //测试账号appid
$appsecret = ‘525f76d57c7bd72005865e05d03e9dbe‘; //测试账号

$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";
$json = file_get_contents($url); 
$re = json_decode($json,true);
$access_token = $re[‘access_token‘];  
//使用全局ACCESS_TOKEN获取OpenID的详细信息
//$openid = ‘ohzcAsy35rFHUcabQkAXPmv2FC00‘;
// $openid = $_GET[‘openid‘];
// $url = ‘https://api.weixin.qq.com/cgi-bin/user/info?access_token=‘.$access_token.‘&openid=‘.$openid;
// $json = file_get_contents($url);
// $arr = json_decode($json,true);
// $name = $arr[‘nickname‘];
// $imgURL = $arr[‘headimgurl‘];
// $sex = $arr[‘sex‘];
// $province = $arr[‘province‘];
// $city= $arr[‘city‘];
// $country= $arr[‘country‘];
// var_dump($arr);
?>




微信获得access_token

上一篇:【转】高仿微信对话列表滑动删除效果--不错


下一篇:微信配置