微信公众号验证(PHP)

public function index(){
  $timestamp = $_GET['timestamp'];
  $nonce = $_GET['nonce'];
  $token = 'weixin';
  $signature = $_GET['signature'];

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

  $tmpstr = implode('', $array);
  $tmpstr = sha1($tmpstr);

  if ($tmpstr == $signature) {
    echo $_GET['echostr'];
    exit;
  }
}

你可能感兴趣的:(微信公众号验证(PHP))