收藏
回答

调用img_sec_check 返回的数据为空?

$token = get_access_token();

$data['media'] = new \CURLFile($image_url);
//$data = json_encode(array('content'=>$msg),JSON_UNESCAPED_UNICODE);
//$data = json_encode(array('media'=>$msg),JSON_UNESCAPED_UNICODE);

$url = "https://api.weixin.qq.com/wxa/img_sec_check?access_token=".$token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL,$url); // url
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // json数据
$dataJson = curl_exec($ch); // 返回值
curl_close($ch);
$return_url= json_decode($dataJson,true);

Log::error('return_url:'.$dataJson);
if(isset($return_url['errcode'])){
   if($return_url['errcode'] != 0){
       $ret_code = $return_url['errcode'];//返回结果
   }
   $ret_code = $return_url['errcode'];//返回结果
}else{
   $ret_code = 100;//返回结果
}


最后一次编辑于  11-12
回答关注问题邀请回答
收藏

1 个回答

问题标签