errcode":41005,"errmsg":"media data missing hint: [05443954] rid: 65a101b0-53920c02-56542908"
$url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=".$ACCESS_TOKEN."&type=image";
if(class_exists('\CURLFile')){
$real_path = "D:\www_pro\WWW\winfully_cn_svn\public\balance.png";
$data = array(
"access_token" => $ACCESS_TOKEN,
"media" => new \CURLFile($real_path),
);
}else{
echo "环境比较低无法上传";
exit();
}
$result = $this->request_post($url,helper::jsonEncode($data));
halt($result);
private function request_post($url = '', $data = ''){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , true);
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, $data);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
media没传对位置,微信没拿到。可惜我不会php