環(huán)境是:yii2-authclientweibo.upload接口感謝思路/點撥,這個問題應該不限定在yii2框架內.接口文檔:pic類型:binary描述:要上傳的圖片,僅支持JPEG、GIF、PNG格式,圖片大小小于5M。我的代碼:publicfunctionsendUpload($text,$url){return$this->api('2/statuses/upload.json','POST',['status'=>$text,'visible'=>self::VISIBLE_ALL,'pic'=>'@'.$url,'source'=>$this->source,]);}執(zhí)行后返回的錯誤:{"error":"unsupportmediatype(application/x-www-form-urlencoded)","error_code":10007,"request":"/2/statuses/upload.json"}微博提供的演示代碼:functionupload($status,$pic_path,$lat=NULL,$long=NULL){$params=array();$params['status']=$status;$params['pic']='@'.$pic_path;if($lat){$params['lat']=floatval($lat);}if($long){$params['long']=floatval($long);}return$this->oauth->post('statuses/upload',$params,true);}
oauth2: 對 api 如何上傳文件?
收到一只叮咚
2019-03-30 11:32:34