You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
802 B
24 lines
802 B
<?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);
|
|
?>
|