<?php define("TOKEN", "自己定义"); $wechatObj = new wechatCallbackapiTest();
$wechatObj->valid(); class wechatCallbackapiTest{ public function valid(){
$echoStr = $_GET["echostr"]; if($this->checkSignature()){ echo $echoStr; exit;
} }private function checkSignature(){ $signature = $_GET["signature"];
$timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = TOKEN;
$tmpArr = array($token, $timestamp, $nonce); sort($tmpArr); $tmpStr = implode(
$tmpArr ); $tmpStr = sha1( $tmpStr ); if( $tmpStr == $signature ){ return true;
}else{ return false; } } } ?>

技术
今日推荐
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信