为什么不直接放video
小程序banner轮播图支持gif图片么?小程序的banner轮播图支持gif或者swf格式的内容进行展示么
2019-10-19控制器 //内容安全识别 $data['content'] = $request->post('content'); $content = $data['content']; $output = $this->curlText($content); if($output->errcode!=0){ return json(['code' => 500,'msg'=>'内容含有违法违规内容,请修改后再提交']); die; } //检测文本是否含有违禁内容(频率限制:单个 appId 调用上限为 1000 次/分钟,100,000 次/天) private function curlText($content){ $ACCESS_TOKEN = $this->getAccessToken(); $url = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=".$ACCESS_TOKEN; $file_data = '{ "content":"'.$content.'" }';//$content(需要检测的文本内容,最大520KB) $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch , CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $file_data); $output = curl_exec($ch);//发送请求获取结果 $output=json_decode($output,false); curl_close($ch);//关闭会话 return $output;//返回结果 } /*获取access_token,不能用于获取用户信息的token*/ public function getAccessToken(){ $token_file = json_decode(file_get_contents('token.json')); //有效期外才重新获取 if($token_file->expires_time<time()){ $appid = '';//appid $appsecret = '';//秘钥 $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret; $token_json = file_get_contents($url); $token_json = json_decode($token_json); $token_file->access_token = $token_json->access_token; $token_file->expires_time = time()+7200; $access_token = $token_json->access_token; file_put_contents('token.json', json_encode($token_file)); }else{ $access_token = $token_file->access_token; } return $access_token; } token.json内容 {"access_token":"26_QviLchemMs9rCniUSQ3DQy5uQh35r2iXTu3DXHODCZuzYfSfuir-BMLPML317tKuDVD82Yu8SPamH1GdhTXCFjTT-A0M2ZYmC6ONfpw1R5tgvUtzOjIE4rX6J3IKJShAIATSB","expires_in":7200,"expires_time":0}
内容安全api php求助检测内容安全 api 一直返回{"errcode":0,"errmsg":"ok"}。。 测试用例[代码]特3456书yuuo莞6543李zxcz蒜7782法fgnv级 完2347全dfji试3726测asad感3847知qwez到[代码]开发者可使用以上两段文本进行测试,若接口errcode返回87014(内容含有违法违规内容),则对接成功。 一直返回{"errcode":0,"errmsg":"ok"} 这是对接失败了吧 $data_json = json_encode(array('content'=>'特3456书yuuo莞6543李zxcz蒜7782法fgnv级他麻痹')); $url = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=".$ztoken; $content = http_post_data($url,$data_json); echo $content; function http_post_data($url, $data_json) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); return $data; } 求救,有demo最好 急急急 谢谢
2019-10-19