eaglephp使用微信api接口开发微信框架(2)


 /**
  * 检验签名
  */
 public function checkSignature()
 {
        $signature = HttpRequest::getGet('signature');
        $timestamp = HttpRequest::getGet('timestamp');
        $nonce = HttpRequest::getGet('nonce');

  $token = $this->token;
  $tmpArr = array($token, $timestamp, $nonce);
  sort($tmpArr);
  $tmpStr = implode($tmpArr);
  $tmpStr = sha1($tmpStr);

  return ($tmpStr == $signature ? true : false);
 }

 
 /**
  * 验证token是否有效
  */
 public function valid()
 {
  if($this->checkSignature()) exit(HttpRequest::getGet('echostr'));
 }

}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/5e3829ac1fcd1cb82a721c2b99a61029.html