문제

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