'why i am getting ? along with query parameters in laravel 8?
I am sending request via query parameters in laravel but this error is very uncommon to me as i have never seen this before what it actually does is it adds ?in very first key like this
array:1 [▼
"?name" => "google"
]
while hitting this url
http://travel.localhost/home?name=google
dd($_GET);
dd(request()->all());
dd(request()-get('name'));
i have done all these method but for first two lines i am getting ?name =
and for third line i am getting null as i am looking for name but request is ?name
as per my knowledge we use GET request frequently and bind required parameters in query parameter like ?param1=¶m2=¶m3 ... and so on
so please anyone having any idea why this error occured or is anything wrong in my project
is this can be related to server as i am doing this on nginx but when i am using serve method
and serving my project on localhost:8000 then this problem is not there
any help
Thank you!!
Solution 1:[1]
Because get method pass parameter like that try using post method
Solution 2:[2]
This may be due to it is consider ? as a special char. If you could try below link? http://travel.localhost/home?act=1&name=google
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nishan Timsina |
| Solution 2 | nand Maithani |
