Get parameter with Slim Framework 3

-1

I need help getting the parameter id at the moment the URI is called, passing it to container .

Follow the code below:

$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;
}

Thank you in advance.

    
asked by anonymous 26.01.2016 / 23:53

1 answer

-1

I did not exactly understand your doubts. But I use this code to get the ID passed by parameter via GET.

$app->get('/usuarios/:id', function($id) use($daoUsuario) {
  $daoUsuario->getById($id);
});
    
13.05.2016 / 02:15