optional parameters in route definition |
(08-29-2023, 10:27 AM)davis.lasis Wrote: I would manage like this Indeed, it is a good alternative. The problem I have with this is that by using the *any* placeholder, any string will be allowed in the URL and therefore can possibly generate an error at the controller level. Unless I first test the parameters received by my controller method before really starting my business logic. I will keep the use of 2 routes, knowing that the 2nd parameter of my controller method is optional. There at least I know that the URL verification will be managed by CodeIgniter. PS: In general, I am very restrictive, I prefer to define strong routing (without the auto router and using strict regex) (08-29-2023, 08:55 PM)kenjis Wrote: Yes, there is no optional parameters.Don't you think it would be interesting to have it? There are multiple use cases that may require it. The solution could be using the AutoRouter or using the "_remap" method but having strict defined routes is more secure in my opinion |
Messages In This Thread |
optional parameters in route definition - by Dimtrovich - 08-29-2023, 02:31 AM
RE: optional parameters in route definition - by davis.lasis - 08-29-2023, 10:27 AM
RE: optional parameters in route definition - by Dimtrovich - 08-30-2023, 02:05 AM
RE: optional parameters in route definition - by kenjis - 08-29-2023, 08:55 PM
|