Home > Mobile >  why i am getting ? along with query parameters in laravel 8?
why i am getting ? along with query parameters in laravel 8?

Time:02-18

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=&param2=&param3 ... 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!!

CodePudding user response:

Because get method pass parameter like that try using post method

CodePudding user response:

This may be due to it is consider ? as a special char. If you could try below link? enter image description here

  • Related