Welcome Guest, Not a member yet? Register   Sign In
redirect to index if function not exist

i know this may hav been answered but i am having a problem following the solutions provided.

can somebody help in this specific situation using this specific logic:
i hav an app. i am adding a _remap function to catch nonexistent functions. problem is how do i pass the parameters to the called method. method below strangely does not work. check this:

function _remap($method) {
if(!(in_array($method, get_class_methods($this))))
} else
$methodArguments = implode(',', array_slice($this->uri->segment_array(), 2));

First of all, the method for check if a function exist is kinda strange as there's a simple function for checking that:
if ( ! method_exists($this, $method))

And to the second part: whether it's a string or an array, it still is just one variable. Why don't you just use the segment_array() within your functions if you want to call them like this?

Or this might also work:
call_user_func_array(array($this, $method), array_slice($this->uri->segment_array(), 2));

thanks lab assistant for that method. i think i got confused while trying different methods of coming up with that 1.

regarding second part, i have my methods receiving 2 or 3 variables which i want separated by commas. strange thing is y wudn't an implode work ?? any other easy ways ??

Theme © iAndrew 2016 - Forum software by © MyBB