批改状态:合格
老师批语:
public static function valid()
{
$signature = input('get.signature');
$timestamp = input('get.timestamp');
$nonce = input('get.nonce');
$echostr = input('get.echostr');
$token = config('app.weixin_token');
$tmpArr = array($timestamp, $nonce, $token);
sort($tmpArr, SORT_STRING); // 数组排序
$str = implode($tmpArr); //implode 拼接字符串
return sha1($str) == $signature ? true : false; // 需要进行 sha1 加密
}点击 "运行实例" 按钮查看在线实例




Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号