Welcome Guest, Not a member yet? Register   Sign In
Displaying a 404 if wrong number of segments passed to controller function?
#1

[eluser]Unknown[/eluser]
Hello,

I have a question about handling unexpected URL segments and showing errors.

For example: given a URL that resembles /controller_class/function/variable, I was expecting CodeIgniter to display a 404 if the function does not except a parameter. Or, more generally, I would expect that if the number of URL segments is greater than the number of parameters for the given function, that the URL is not valid and should display an error to the user.

Since no error is given, is there a way to check for such a condition that doesn't involve checking the parameters on a per-function basis? That could get repetitive. I haven't worked with PHP5 enough to know about the Reflection APIs but my understanding is that there's a way to check on the number of parameters of a Class' method...

... or perhaps I've just overlooked something obvious. Any insight would be appreciated. Thanks!


Messages In This Thread
Displaying a 404 if wrong number of segments passed to controller function? - by El Forum - 05-26-2011, 02:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB