A multi-condition filtering question type: type, the parameters are 1, 2, 3, etc. Region: city, the parameters are 12, 22, 44, 44, etc. Price: cate, the parameters are 1, 2, 3, 4. The current URL address is: http://localhost/school/type/1/city/12/cate/1/. How can I reduce this URL address to this: http://localhost/school/1-12- 1/, that is, hiding parameter names such as type, city, and cate. This problem may lead to the following two problems: 1. If the URL entered by the user is: http://localhost/school/1-1, because the parameters passed are all IDs, that is, the order of the parameters is disrupted, how to ensure the result? normal. 2. If the URL entered by the user is: http://localhost/school/1, that is, no other parameters are selected, how to ensure that the result is normal. Thank you so much
Shouldn’t POST be used for optional parameters?
First of all, these two problems are basically not a problem. They can be solved by url routing control, so there will be no confusion. Just implement the default value in the null parameter code. qq895163012
You can use routing in TP5
or
and then use explode() to separate the id
in the controllerTop up