array(2) {
["errcode"] => int(40029)
["errmsg"] => string(47) "invalid code, hints: [ req_id: 3DJbojwgE-Wwo1 ]"
}
用了一段时间用户发现报错然后
查看了一下代码错误代码:
1 $wx_post = ‘ { 2 "touser":"‘.$openid.‘", 3 "template_id":"6phJgPCq-t6tdT7UkIePzTnhJXz8jmrqnvSTbabNZdk", 4 "url":"‘.$rec_url.‘", 5 6 "data":{ 7 "first": { 8 "value":"‘.$params["title"].‘", 9 "color":"#173177" 10 }, 11 "keyword1":{ 12 "value":"‘.$params["title"].‘", 13 "color":"#123177" 14 }, 15 "keyword2": { 16 "value":"‘.date("Y-m-d H:i:s").‘", 17 "color":"#103170" 18 }, 19 "keyword3": { 20 "value":"‘.$params[‘content‘].‘...", 21 "color":"#173007" 22 }, 23 "remark":{ 24 "value":"情系客户·真诚服务", 25 "color":"#173177" 26 } 27 } 28 }‘;
发现用回车等tab字符就会报错40029 40007等字符问题
然后修改后:
1 $wx_post=[‘touser‘=>$openid, 2 ‘template_id‘=>‘6phJgPCq-t6tdT7UkIePzTnhJXz8jmrqnvSTbabNZdk‘, 3 ‘url‘=>$rec_url, 4 ‘data‘=>[‘first‘=>[‘value‘=>$params["title"],‘color‘=>‘#173177‘], 5 ‘keyword1‘=>[‘value‘=>$params["title"],‘color‘=>‘#123177‘], 6 ‘keyword2‘=>[‘value‘=>date("Y-m-d H:i:s"),‘color‘=>‘#123177‘], 7 ‘keyword3‘=>[‘value‘=>$params[‘content‘],‘color‘=>‘#123177‘], 8 ‘remark‘=>[‘value‘=>‘情系客户·真诚服务‘,‘color‘=>‘#123177‘] 9 ] 10 ]; 11 12 $wx_post = json_encode($wx_post); 13 14 // exit($wx_post);//QQ496631085 15 16 $res_code = json_decode(Http::post($url,$wx_post),true);
然后就不怕有特殊字符了
[“errcode”]=>整数(40029)
[“errmsg”]=>字符串(47)“无效代码,提示:[req u id:3DJboywgE-Wwo1]”