标签:include timestamp The key nbsp mmm 平台 echo 验证
1、
2、
3、URL接受值进行签名验证。
<?php
include_once "../commmm/WXBizMsgCrypt.php";/*微信提供 demo*/
// 假设企业号在公众平台上设置的参数如下
$encodingAesKey = "mPNKZTChTEAVeJvoVlDOYf1rH3wCMNmuRVQ8wtgVsV5";
$token = "1234";
$receiveid = "";
$wxcpt = new WXBizMsgCrypt($token, $encodingAesKey, $receiveid);
// get the paramters
$sVerifyMsgSig = $_GET[‘msg_signature‘];
$sVerifyTimeStamp = $_GET[‘timestamp‘];
$sVerifyNonce = $_GET[‘nonce‘];
$sVerifyEchoStr = $_GET[‘echostr‘];
$sEchoStr = "";
$errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr);
if ($errCode == 0) {
$url = "http://www.baidu.com";
header("Location:$url");
} else {
print("ERR: " . $errCode . "\n\n");
}
?>
标签:include timestamp The key nbsp mmm 平台 echo 验证
原文地址:https://www.cnblogs.com/yyhhblog/p/10021067.html