Codeigniter get controller name in helper

后端 未结 4 670
醉酒成梦
醉酒成梦 2021-02-08 04:13

I have a custom helper that i use for logging.

Within one of the functions of the helper i need to get the name of the controller that was called. Is there a way to do i

4条回答
  •  自闭症患者
    2021-02-08 04:59

    You can also use the URI class

    $ci = & get_instance();
    $ci->uri->segment(1) // That stands for controller
    $ci->uri->segment(2) // That stands for method
    

提交回复
热议问题