问答详情
源自:4-6 提交验证接口

验证token失败


<?php

//1.将timestamp,nonce,token按字典序排序

      $timestamp   =$_GET['timestamp'];

          $nonce   =$_GET['nonce'];

 $token   ='weixin';

     $signature    =$_GET['signature'];

$array        =array($timestamp,$nonce,$token);

sort($array);

//2.将排序后的三个参数拼接之后用shal加密

    $tmpstr        =implode('',$array);//jojn

$tmpstr         =shal($tmpstr);

//3.将加密后的字符串与signature进行对比,判断请求是否来自微信

           if($tmpstr==$signature){

  echo  $_GET['echostr];

  exit

  }

//验证token失败,微信token,weixin写的和代码里的一样,问题就不知在那里


提问者:肖力华 2015-10-25 01:08

个回答

  • 肖力华
    2015-10-28 21:43:47

    sort($array,SORT_STRING);

    加呢后说参数错误

  • 乔帮主
    2015-10-25 09:05:04

    我也遇到这个问题了! 不知道咋回事!