企业微信自建应用设置API接收消息,提示“openapi回调地址请求不通过” 测试回调模式不返回明文
直接网页打开请求,正常返回123.
/**
* 回调函数
*/
public function callBack(Request $request){
$encodingAesKey = ""; //回调里面的EncodingAESKey
$token = ""; //回调里面的token
$corpId = ""; //企业id
$sVerifyMsgSig = $request->param('msg_signature');
$sVerifyTimeStamp = $request->param('timestamp');
$sVerifyNonce = $request->param('nonce');
$sVerifyEchoStr = $request->param('echostr');
$wxcpt = new \WXBizMsgCrypt($token, $encodingAesKey, $corpId);
$errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr);
if ($errCode == 0) {
return $sEchoStr;
} else {
print("ERR: " . $errCode . "\n\n");
}
}
企业微信相关问题请到企业微信社区咨询 https://developer.work.weixin.qq.com/community/question