Correction status:qualified
Teacher's comments:
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 加密 }
点击 "运行实例" 按钮查看在线实例