获取全局 的access_token:把下面的appid,secre 换成自己的。,然后回车,就得到了。每过7200秒会失效,,,然后粘贴底部菜单代码即可
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
网页授权:access_token和access_token有区别需注意,,拿到此access_token和openid来获取用户信息
{ "button": [ { "type": "click", "name": "今日歌曲", "key": "V1001_TODAY_MUSIC" }, { "name": "菜单", "sub_button": [ { "type": "view", "name": "搜索", "url": "http://www.soso.com/" }, { "type": "view", "name": "授权", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=自己的appid&redirect_uri=【这里是转码之后的地址】https%3A%2F%2Fliupandeng123.applinzi.com%2Fh10demo%2FgetUserinfo.php&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect" }, { "type": "click", "name": "赞一下我们", "key": "V1001_GOOD" } ] } ] }
在php中转码:
<?php $url = "这里是填自己的服务器地址https://1.xiasize.applinzi.com/h10demo/getUserinfo.php"; $url = urlencode($url); echo $url; ?>