ccdr
public function actionIndex(){
        $nonce = Yii::$app->request->get(\'nonce\');
        $token = \'adshare\';
        $timestamp = Yii::$app->request->get(\'timestamp\');
        $echostr = Yii::$app->request->get(\'echostr\');
        $signature = Yii::$app->request->get(\'signature\');
        $array = array();
        $array = array($nonce,$timestamp,$token);
        sort($array);
        $str = sha1(implode($array));

        /*if($str == $signature){
            echo $echostr;
        }*/
        if($str == $signature && $echostr){
            return $echostr;
        }else{
            self::actionMessage();
        }
    }

 

 

注意方法中被注释的代码,不管是初次还是再次修改,都需要把$echostr返回给微信,才能正确验证,否则会一直提示token的问题!

分类:

技术点:

相关文章:

  • 2021-04-02
  • 2022-01-28
  • 2021-04-05
  • 2021-09-11
  • 2022-12-23
  • 2021-12-14
  • 2021-06-30
  • 2022-01-30
猜你喜欢
  • 2022-01-14
  • 2022-01-25
  • 2022-01-12
  • 2022-02-18
  • 2022-02-09
  • 2022-12-23
  • 2021-10-02
相关资源
相似解决方案