Answer the question
In order to leave comments, you need to log in
Slim 3 doesn't accept GET parameters?
I am writing an API on this framework and I wanted to accept GET parameters, but nothing comes up. Although if you specify the path /send/sms/79999999999 as an argument, it processes normally.
$app->get('/send/sms', function ($request, $response, $args) {
print_r($_GET);
print_r($_GET['phone']);
});
Answer the question
In order to leave comments, you need to log in
I know this question has been asked for a long time, but maybe it will help someone. To get the $_GET array, it's something like this:
//для адреса http://site.ru/send/sms?phone=+7000000000
$app->get('/send/sms', function(Slim\Http\Request $request, Slim\Http\Response $response, $args){
//$request->getQueryParams() - весь массив $_GET
echo $request->getQueryParam('phone');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question