微擎签名出错 invalid signature

微擎签名出错

错误信息: config:fail,Error: 系统错误,错误码:63002,invalid signature

修改方法:

PHP 端

$account_api = WeAccount::create();
$jssdk = $account_api->getJssdkConfig("当前网页的URL");
// 关闭调试模式
$jssdk['debug'] = false;
// 选择使用获取地图信息的API
$jssdk['jsApiList'] = ['getLocation'];
exit(json_encode($jssdk));

HTML 端

<script>
$.post("请求地址", 请求参数, function (data) {
  // 将返回的签名数据写入到wx.config中
  wx.config(data);
  console.log(data);

  wx.getLocation({
    type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
    success: function (res) {
      var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
      var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
      var speed = res.speed; // 速度,以米/每秒计
      var accuracy = res.accuracy; // 位置精度
      console.log(res);
    }
  });
}, 'json');
</script>
 
原文地址:https://www.cnblogs.com/GetcharZp/p/11855649.html