环境是: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,]);}执行后返回的错误:{"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);}
神不在的星期二
繁华开满天机
相关分类