zongsir

第一次成功了,第二次总是失败,很简单,session问题

 

 clearstatcache();
        $_SESSION = \'\';
        $_COOKIE = \'\';
        //获得参数 signature nonce token timestamp echostr
        $nonce     = $_GET[\'nonce\'];
        $token     = \'6699ssszzz\';
        $timestamp = $_GET[\'timestamp\'];
        $echostr   = $_GET[\'echostr\'];
        $signature = $_GET[\'signature\'];
        //形成数组,然后按字典序排序
        $array = array();
        $array = array($nonce, $timestamp, $token);
        sort($array);
        //拼接成字符串,sha1加密 ,然后与signature进行校验
        $str = sha1( implode( $array ) );
        if( $str == $signature && $echostr ){
            //第一次接入weixin api接口的时候
            echo  $echostr;
            exit;
        }

 

 

不要回来谢我

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2021-12-08
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
猜你喜欢
  • 2021-04-02
  • 2022-12-23
  • 2021-07-06
  • 2022-01-12
  • 2021-10-26
  • 2021-12-18
相关资源
相似解决方案