我想记录我的应用程序使用post_controller_constructor
钩子收到的请求。
下面的钩子代码说明了我需要什么:
public function log() {
$controller = $this->router->fetch_class();
$action = $this->router->fetch_method();
$post_params = $this->input->post();
$get_params = $this->input->get();
$url_params = ???;
...
$this->log_model->log($id_user, $controller, $action, time(), $post_params, $get_params, $url_params);
}
function __get($key){
$CI =& get_instance();
return $CI->$key;
}
对于我所看到的,解决方案必须与“URI”类和从那里提取的段相关。但我不能依赖这种方法,因为我有一些控制器比其他控制器更深,比如这个例子:
/folder/set_controllers/controller_a/action/(:any)
/folder/set_controllers/controller_a/action/7
$url_params
的值为array('7')
。/folder/controller_b/action/(:any)/(:any)
/folder/controller_b/action/first_param/second_param/7
$url_params
的值为array('first_param', 'second_param')
。/controller_c/action/(:any)
/controller_c/action/hello
$url_params
的值为array('hello')
。
我需要知道有什么价值观$url_params
。
提前致谢。