代码:
$obj = new \CURLFile(realpath($filePath));
$obj->setMimeType("image/jpeg");
$file['media'] = $obj;
$url = "https://api.weixin.qq.com/wxa/img_sec_check?access_token=".$accessToken;
$info = $this->http_request($url,$file);
$info = json_decode($info,true);
dump($info);
//HTTP请求(支持HTTP/HTTPS,支持GET/POST)
private function http_request($url, $data = null)
{
$curl = curl_init();
// curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS,$data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
任何图片及大小,接口返回的都是ok,麻烦大神们帮我看下问题出在哪儿
发出来看看呢
检查下接收到的图是否正确