2013-03-27 4 views
1
public function _remap($method) 
{ 
    if ($method == 'some_method') 
    { 
     $this->$method(); 
    } 
    else 
    { 
     $this->default_method(); 
    } 
} 

이것은 공식 사이트에서 읽은 것입니다. 내가 알기로 _remap 메쏘드는 모든 액션 전에 호출된다. 그러나이 명령어 $this->$method();은 $ method를 호출하면 _remap을 다시 호출 할 것이고 cycle과 같은 것을 의미합니다. 그렇지 않니? Codeigniter 2 : 컨트롤러에서 with_remap 메서드를 잘못 이해했습니다.

그것이 도움이 희망 ...

답변

1

아니, _remap는 초기화시, 프레임 워크에 의해 호출되지만 직접 몇 가지 메서드를 호출 할 때, 당신은 단지 기능의 내용을 실행!

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. 
:

일부 설명은 here 발견