protected function encryptMsg($replyMsg, $timestamp, $nonce)
{
$msg = '';
//传入公众号第三方平台的token(申请公众号第三方平台时填写的接收消息的校验token), 公众号第三方平台的appid, 公众号第三方平台的 EncodingAESKey(申请公众号第三方平台时填写的接收消息的加密symmetric_key)
$pc = new WXBizMsgCrypt($this->token, $this->encodingAesKey, $this->appId);
//第三方收到公众号平台发送的消息
$errCode = $pc->encryptMsg($replyMsg, $timestamp, $nonce, $msg);
if ($errCode == 0) {
return $msg;
}
throw new WechatException('encrypt msg error. error code ' . $errCode);
}