回调模式开启--微信企业号--php

include_once "WXBizMsgCrypt.php";

$encodingAesKey = "XXX";  //此处填写你的微信的EncodingAESKey  
$token = "xxx";    //此处填写token  
$corpId = "xxx";   //此处填写corpid ,所有的都要跟微信后台的一样  
 
$sVerifyMsgSig = $_GET["msg_signature"];     //此处改为_GET方法用于获得数据,下面一样  
$sVerifyTimeStamp = $_GET["timestamp"];  
$sVerifyNonce = $_GET["nonce"];  
$sVerifyEchoStr = $_GET["echostr"];  
 
// 需要返回的明文  
$EchoStr = "";  
 
$wxcpt = new WXBizMsgCrypt($token, $encodingAesKey, $corpId);  
$errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr);  
if ($errCode == 0) {  
    //  
    // 验证URL成功,将sEchoStr返回  
    echo $sEchoStr;     //此处改为 echo 用与返回解密出的明文  
} else {  
    print("ERR: " . $errCode . "\n\n");  


你可能感兴趣的:(php,PHP,微信)