/** * 生成签名 * @return string 签名,本函数不覆盖sign成员变量,如要设置签名需要调用SetSign方法赋值 */ public function MakeSign ($data) { //签名步骤一:按字典序排序参数 ksort ($data); $string = self::ToUrlParams ($data); //签名步骤二:在string后加入KEY if (empty($this->key)) $this->key = '你的数字签名key'; $string = $string . "&key=" . $this->key; //签名步骤三:MD5加密 $string = md5 ($string); //签名步骤四:所有字符转为大写 return strtoupper ($string); }
midasGetBalance 90011 sig errorPHP后端请求 按照文档的签名算法 [图片] PHP实现 $stringA = "appid=".config('wx')['appid']."&offer_id=1450016276&openid=".$openid."&pf=android&ts=".$time."&zone_id=1"; $stringSignTemp= $stringA."&org_loc=/cgi-bin/midas/sandbox/getbalance&method=POST&secret=zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u"; $sig = hash_hmac('sha256', $stringSignTemp, 'zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u'); 返回错误 {"errcode":90011,"errmsg":"sig error hint: [JdHZea0977shb1]"} 一开始是mp_sig错误 ,解决了mp_sig问题后出现sig错误,算法检查了很多次,还是一直失败
2018-07-30