收藏
回答

微信开放平台,第三方平台代小程序实现业务,修改小程序头像的接口,根据接口要求上传

使用永久素材和临时素材都报错 invalid media_id hint

$postUrl = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=$token&type=$type";
$ch = curl_init();
$url = str_replace(env('CDN_URL'), public_path(), $url);
$file = new \CURLFile($url);
// \Log::info($file);
$data = array('name' => 'media', 'file' => $file);

临时素材接口返回


在微信接口调试工具验证这个mediaid是正确的


接下来提交到头像修改接口直接报错

$setNicknameUrl = 'https://api.weixin.qq.com/cgi-bin/account/modifyheadimage?access_token='.$auth_info['authorizer_access_token'];
$postData['head_img_media_id'] = $res['media_id'];
$postData['x1'] = (float)0;
$postData['y1'] = (float)0;
$postData['x2'] = (float)1;
$postData['y2'] = (float)1;
$res = $this->curl_post($setNicknameUrl, $postData, 'json');




请问这种情况是怎么回事呢


回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容