1.填写网址url和token,其中token可由开发者可以任意填写,用作生成签名。
2.服务器端验证代码:
define ( "TOKEN", "sunan223" );
$signature = $_GET ['signature'];
$nonce = $_GET ['nonce'];
$timestamp = $_GET ['timestamp'];
$echostr = $_GET ['echostr'];
$tmpArr = array ($nonce, $timestamp, TOKEN );
sort ( $tmpArr );
$tmpStr = implode ( $tmpArr );
$tmpStr = sha1 ( $tmpStr );
if ($tmpStr == $signature) {
echo echostr;
}