1

How do I get all query parameters from the url?

So let's say the url is:

http://website.com?page=1&?forum=test

I need this part in my controller:

http://website.com?page=1&?forum=test

the query parameters can be different with every request. So Input::get('page'); or Input::get('forum');does not help because I don't know what to can expect.

Already looked at the docs but I can't find it.

Thanks

1 Answer 1

4

You can get all parameters with

$params = $request->query->all();

More information about the request object can be found at the Symfony's Request documentation page.

This is a recommended way of accessing Request data, never rely on Superglobal arrays like _GET and such.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.