接口地址:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/sec-center/sec-check/msgSecCheck.html
public function checkTextResult($token,$text,$openid)
{
$client = new Client();
$headers = [];
$body = [
'openid' => $openid,
'scene' => '2',
'content' =>mb_convert_encoding($text,"UTF-8"),
'version' => '2'
];
$request = new Request('POST', 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' . $token,
$headers, json_encode($body)
);
$res = $client->sendAsync($request)->wait();
$result = $res->getBody()->getContents();
$result = json_decode($result,1);
if ($result['errmsg'] == 'ok' && $result['result']['suggest'] == 'pass') {
return $result;
} else {
throw new Exception("您的内容含有敏感信息,请修改");
}
}
以上是我发布的评论内容,检测结果这也能过吗?
你好,核实所反馈的小程序并未成功接入内容安全接口,传入的content显示为\u5***\u5***\u5***,导致无法识别,请使用utf-8编码。