我刚刚迁移到一个新的服务器,仍然是基于linux的。移动后,我看到了一个变化的行为-由于某种原因,订单id发送的facebook信用回调在有效载荷格式为:2.6040261734251 e + 14而不是:143121239125639(这些不一定是相同的订单号,只是参考格式)…
当从$_REQUEST中获取时,格式直接到达,并且在DB插入之前…有人知道为什么格式会这样改变吗?谢谢!
——edit——我使用parse_signed_request函数从签名请求中获取变量:
function parse_signed_request($signed_request, $secret) {
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
// decode the data
$sig = base64_url_decode($encoded_sig);
$data = json_decode(base64_url_decode($payload), true);
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
error_log('Unknown algorithm. Expected HMAC-SHA256');
mail('example@example.com','server error','Unknown algorithm. Expected HMAC-SHA256');
return null;
}
// check signature
$expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
if ($sig !== $expected_sig) {
error_log('Bad Signed JSON signature!');
return null;
}
return $data;
}
正如Charley p .注意到的,我确实使用32位服务器而不是以前的64位服务器。这会不会破坏上面使用
的函数?json_decode(base64_url_decode($payload), true);
再次感谢…
您的旧服务器必须是64位的,而您的新服务器是32位的
尝试使用原始数字作为字符串