php -对数据进行加密验证判断
//判断数据是否正确
$isDecode = $this->decode($data);
if ($isDecode == false) return (['code' => 301, 'message' => '验签失败,请刷新重试!']);
//验签
public function decode($data)
{
$sign = $data['sign'];
unset($data['sign']);
$key = config('basic.workerOrderKey');
$str = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$newSign = md5($str . $key);
if ($newSign == $sign) {
return true;
} else {
return false;
}
}
'workerOrderKey'=>'49bf1e90a6f2157950faeed4636c7f88',