Closed jerfeson closed 5 years ago
Hi, route params and get/post params are two diferent things. example: If you have a route like
$app->any('/welcome/{id}', function(Request $request, Response $response, $args) use($app) {
return $app->resolveRoute('\App\Http\Site', 'Welcome', 'index', $args);
});
and you call: http://localhost:8080/index.php/welcome/10?x=20
your controller welcome can be like:
<?php
namespace App\Http\Site;
use \App\Http\Controller;
class Welcome extends Controller
{
public function index($id)
{
// get route param id. this gets automatically injected by the framework into the method.
echo $id . "<br/>";
// get para id from GET
echo $this->request->getQueryParam('id') . "<br/>";
// get all GET params
debug($this->request->getQueryParams());
// get all POST params
debug($this->request->getParsedBody());
}
}
I'm trying something simple, get the parameters via get, but something seems not to be right. Can anyone help me understand?
At this point I have the attribute
But not here