登录

php进行微信文本安全校验老是提示数据格式错误,求大佬解答

代码:

$text=$_GET['text'];//文本内容

$data = array(

    'openid'=>$openid,

    'content'=>$text,

    'version'=>2,

    'scene'=>3

);

$data = http_build_query($data);

$url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='.$access_token;

$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,$url);

curl_setopt($ch,CURLOPT_HEADER,0);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_POST, 1);//POST提交

curl_setopt($ch,CURLOPT_POSTFIELDS,$data);//POST数据

$result = curl_exec($ch);

echo $result;

curl_close($ch);

输出结果:

data: {errcode: 47001, errmsg: "data format error rid: 63608120-7a9be7c8-1bf52c51"}

# PHP
P粉821173971P粉82117397188 天前214 次浏览

全部回复(0) 我要回复

暂无回复
  • 取消回复发送