🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
接口接入 和 微信消息验证 如果有$_GET['echostr']说明是开发者接入,验证成功 ,原样返回字符串。 没有$_GET['echostr']参数,则验证消息是否符合规则,基本验证过滤恶意请求。 ~~~ /** * 验证 */ public function authentication() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $tmpArr = array($this->_token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $sign = sha1($tmpStr); if ($sign == $signature) { if(isset($_GET['echostr'])){ return $_GET['echostr']; } return true; } return false; } ~~~