通过发布改造参数并获得结果

时间:2019-12-06 20:58:46

标签: android retrofit2

这是我的Api.php

$command=$_POST["command"];
if($command=="getUsers"){
    getUsers();
}
elseif ($command=="getNews")
{
   getNews();
}

我正在使用改造来在我的android应用中显示结果。我需要通过Retropost传递参数Command并同时获取结果。 有什么解决方案?

1 个答案:

答案 0 :(得分:1)

从Retrofit网站尝试以下示例:

@FormUrlEncoded
@POST("user/edit")
Call<User> updateUser(@Field("first_name") String first, @Field("last_name") String last);

来源:https://square.github.io/retrofit/