0
点赞
收藏
分享

微信扫一扫

微信公众号基本配置 TOKEN 验证失败

求阙者 2022-03-30 阅读 67

public function index()
    {
        $echoStr = $_GET["echostr"];
        if($this->checkSignature()){
            header('content-type:text');
            ob_clean();
            echo $echoStr;
            exit;
        }
    }
private function checkSignature()
{
    $signature = $_GET["signature"];
    $timestamp = $_GET["timestamp"];
    $nonce = $_GET["nonce"];
    
    $token = '131haoshenqian031';
    $tmpArr = array($token, $timestamp, $nonce);
    sort($tmpArr, SORT_STRING);
    $tmpStr = implode( $tmpArr );
    $tmpStr = sha1( $tmpStr );
    
    if( $tmpStr == $signature ){
        return true;
    }else{
        return false;
    }
}
 

举报

相关推荐

0 条评论