Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
If url is "http://example.com/api/test?p=1&p=2" and method is "GET", I want to get [1,2] when I trying to call $request->p or $request->query("p").
But now, if url is same, I'll get "2" when I call $request->p.
How to do it?
$request->query('p')
A parameter can only hold one value. In ?p=1&p=2 the second p=... sets the value for the parameter, overwriting the first one. If you want two values your parameter should be an array like this:
?p=1&p=2
p=...
?p[]=1&p[]=2
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
$request->query('p')will get the url parameter "p". You could have found that yourself...