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?

有帮助吗?

解决方案

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.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top