すべてのコントローラーによって拡張されている MY_Controller に追加した次のコードがあります。
public function _remap($method, $params = array())
{//exit($this->router->fetch_class());
if (array_search($method, $this->private_methods) !== false && !$this->logged_in)
{
$this->session->set_flashdata('message', array(
'message' => 'You must login to access the requested area',
'error' => 1
)
);
redirect('/');
}
else if (method_exists($this, $method))
{
$this->$method($params);
}
else
{
redirect('/');
}
}
作成されている問題は、呼び出し$this->$method($params)
がパラメーターを配列に凝縮していることです。したがって、次のようなメソッドは壊れます。
function some_method($param1, $param2, $param3)
この配列をこのような関数の個々の項目に分割する方法はありますか?