//$img-----上传的图片;
$imgs = file_get_contents($img);
$filePath = $_SERVER[‘DOCUMENT_ROOT’].’/upload/images/dev/test.jpg’;
file_put_contents($filePath, $imgs);
$file = [‘media’ => curl_file_create(realpath($filePath),‘image/jpeg’,‘test’)];
$url = ‘https://api.weixin.qq.com/wxa/img_sec_check?access_token=’.$token;
$header =‘formdata’;
$imgSecCheck_res = $this->request_post($url,$file,$header);
…
function request_post($url,$postdata,$header) {…} —————— $header = array(‘Content-Type:multipart/form-data’)
请问大神以上代码有什么问题?
不管上传什么图片都会返回 “{“errcode”:0,“errmsg”:“ok”}”