在这种情况下如何获得参数?
$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);
});
});