I want to log the requests that my app receive using a post_controller_constructor
hook.
The hook's code below illustrate what I need:
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;
}
For what I saw, the solution has to be related with 'URI' Class and the segments extracted from there. But I cannot rely on this aproach because I have that some controllers are deeper than others like this examples:
/folder/set_controllers/controller_a/action/(:any)
/folder/set_controllers/controller_a/action/7
the value for$url_params
isarray('7')
./folder/controller_b/action/(:any)/(:any)
/folder/controller_b/action/first_param/second_param/7
the value for$url_params
isarray('first_param', 'second_param')
./controller_c/action/(:any)
/controller_c/action/hello
the value for$url_params
isarray('hello')
.
And I need to know what values $url_params
have.
Thanks in advance.