【发布时间】:2016-07-09 10:58:25
【问题描述】:
我使用改造来将我的应用程序与 php 服务器通信。但是我想直接调用一个函数PHP OO。
这是我的 PHP 类:
class Car extends Obj {
public function __construct($name, $pathImg) {
parent::__construct($name, $pathImg);
}
function get() {
$engine = new Engine(55, 2016, '5.0');
$brand = new Brand('MY BRAND', null);
$car = new Car('MY CAR', null, $brand, $engine);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(array('car' => $car));
}
}
我在应用中的改造 API:
@FormUrlEncoded
@POST("package/ctrl/Car/")
Call<Car> get(@Field("id") int id);
是否可以通过改造直接调用函数?还是使用其他 API 来完成?
【问题讨论】:
标签: php android request retrofit