1 changed files with 0 additions and 24 deletions
@ -1,24 +0,0 @@ |
|||||
<?php |
|
||||
// 获取access_token和openid |
|
||||
$appid = "wx79343915f99167e6"; |
|
||||
$appsecret = "f2f72c5e0ac29c2373bfaf22cf059c02"; |
|
||||
$redirect_uri = "http://192.168.50.21/mobile/test_get_openid.php"; |
|
||||
|
|
||||
|
|
||||
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=urlencode($redirect_uri)&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; |
|
||||
|
|
||||
// $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=".$_GET['code']."&grant_type=authorization_code"; |
|
||||
$result = file_get_contents($url); |
|
||||
|
|
||||
echo json_encode($result); |
|
||||
|
|
||||
// $obj = json_decode($result); |
|
||||
// $access_token = $obj->access_token; |
|
||||
// $openid = $obj->openid; |
|
||||
|
|
||||
// $message = array( |
|
||||
// "openid"=>$openid, |
|
||||
// "access_token"=>$access_token |
|
||||
// ); |
|
||||
// echo json_encode($message); |
|
||||
?> |
|
||||
Loading…
Reference in new issue