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

これは私が公式サイトから読んだものです。私が理解しているように、_remapメソッドはすべてのアクションの前に呼び出されます。ただし、この命令$this->$method();は、$ methodを呼び出すと_remapが再度呼び出され、cycleのようなものになることを意味します。ではない?

4

1 に答える 1

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.
于 2013-03-27T14:11:16.520 に答える