【发布时间】:2016-01-26 20:19:38
【问题描述】:
在这种情况下如何获取参数?
$this->get('/{id}', function($request, $response, $args) {
return $response->withJson($this->get('singleSelect'));
});
$this->appContainer['singleSelect'] = function ($id) {
return $this->singleSelect($id);
};
public function singleSelect($id) {
return $id;
}
提前致谢。
更新
我的解决方案:
$app->group('/id', function () {
$this->get('/{id}', function($request, $response, $args) {
$this['container'] = $args; //work with $args inside the container
return $this->singleSelect($id);
});
});
【问题讨论】:
标签: php containers slim slim-3