微信公众号服务器配置(校验)

public function serve()
{
$echoStr = $_GET["echostr"];
if($this->checkSignature()){
echo $echoStr;
exit;
}
}
//检查签名
private function checkSignature()
{
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$token = "xxxxxxxxxxx";
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode($tmpArr);
$tmpStr = sha1($tmpStr);
if($tmpStr == $signature){
return true;

}else{
return false;
}
}

微信公众号服务器配置(校验)

上一篇:微信小程序中使用 npm包管理 (保姆级教程)


下一篇:android list view 实现动态加载