Question

public function _remap($method)
{
    if ($method == 'some_method')
    {
        $this->$method();
    }
    else
    {
        $this->default_method();
    }
}

This is what i read from official site. As i understand _remap method is getting called before all actions. But this instruction $this->$method(); means that calling $method will call _remap again and it is being something like cycle. Isn't it?

Était-ce utile?

La solution

No, _remap is called by the framework, during the init, but when you call some method directly, you only execute the function content...

Hope it's helpful!

Some explanation found here:

Important:  If your controller contains a function named _remap(), it will always get called regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called, allowing you to define your own function routing rules.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top