【发布时间】:2016-11-08 14:18:04
【问题描述】:
我正在使用 silex 创建我的 API REST。 在一个例子中,我找到了一种创建路线的方法
$api = $this->app["controllers_factory"];
$api->get('/notes', "notes.controller:getAll");
$api->get('/notes/{id}', "notes.controller:getOne");
$api->post('/notes', "notes.controller:save");
$api->put('/notes/{id}', "notes.controller:update");
$api->delete('/notes/{id}', "notes.controller:delete");
我正在寻找一种方法来包含一个包含所有路由的数组,并在我的应用引导文件上创建和实例化。有什么想法吗?
【问题讨论】: