一、在小程序后台配置参数。
配置的时候会验证服务器,将一下php代码保存放到服务器上就可以通过验证。
二、服务器上的php代码。
valid();
}else{
$wechatObj->responseMsg();
}
class wechatCallbackapiTest
{
public function valid() //第一次验证服务器用
{
$echoStr = $_GET["echostr"];
if($this->checkSignature()){
header('content-type:text');
echo $echoStr;
exit;
}
}
private function checkSignature()
{
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$token = TOKEN;
$tmpArr = array($token, $timestamp, $nonc