重新映射我有下面的代碼,我加入到正由我的所有控制器擴展一個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)
凝聚着PARAMS中的陣列。所以如下面休息方法:
function some_method($param1, $param2, $param3)
有沒有辦法打破這種陣列回個別項目像這樣的功能呢?
這是我的帖子,上面的代碼是基於該代碼。您所指的鏈接中的代碼不會分開參數,而是將它們作爲ARRAY發送。 – 2013-02-28 03:51:20
你可能做錯了什麼。我測試過它正在發送個別參數。創建'Example'控制器並測試答案。 – 2013-02-28 04:10:59