1、配置
1)在微信公众平台 -> 设置-> 公众号设置-> 公众号设置-> Js 接口安全域名里填写js允许的域名。
2) 引入js文件
3) 通过config接口注入权限验证配置
2、后台php代码:
$appid = '你的appid';
$appserver = '你的appserver';
$res = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret=$appserver");
$ress = json_decode($res, true);
$token = $ress[