Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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
Required, but never shown
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.
Explore related questions
See similar questions with these tags.
$request->query('p')will get the url parameter "p". You could have found that yourself...