I pass a parameter of age=22 through the get method, and $request->age can get the corresponding value. However, when executing the 13th line of code in the figure below, why does the if judgment pass and 14 lines of content are directly output?
I don’t understand the usage of passing parameters at all. Are you new to laravel? Use the wrong one. The {age} you wrote is just a placeholder-like thing. The age=22 followed by your route is equivalent to the parameter age=22. You can just follow 22 without adding age. Thank you
Try writing it like this
The very weird url
should be: www.laraveltest.com:8888/agetest/22
or: www.laraveltest.com:8888/agetest?age=22
The url you visited is wrong
I don’t understand the usage of passing parameters at all. Are you new to laravel? Use the wrong one. The {age} you wrote is just a placeholder-like thing. The age=22 followed by your route is equivalent to the parameter age=22. You can just follow 22 without adding age. Thank you