美文网首页
微信公众号开发之验证参数

微信公众号开发之验证参数

作者: 死鬼土匪 | 来源:发表于2019-10-07 22:39 被阅读0次
    <php
    
        //1.获取参数
        $timestamp = $_GET['timestamp'];
        $nonce = $_GET['nonce'];
        $token = 'weixin';//token必须与官网配置一致
        $signature = $_GET['signature'];
    
        //2.拼接,排序,加密参数
        $array = array($timestamp,$nonce,$token);
        sort($array);
        $tmpstr = implode('',$array);
        $tmpstr = sha1($tmpstr);
    
        //3.验证参数
        if ($tmpstr == $signature){
              echo $_GET['echostr'];  
              exit;
         } 
    
        ?>
    

    相关文章

      网友评论

          本文标题:微信公众号开发之验证参数

          本文链接:https://www.haomeiwen.com/subject/ytrvpctx.html