Can CodeIgniter Helper Functions use database functions?

前端 未结 4 941
不思量自难忘°
不思量自难忘° 2021-02-05 13:37

One of my CodeIgniter Controller functions needs to call a recursive function as part of its functionality. The function call chokes if I put it inside the controller class, an

4条回答
  •  广开言路
    2021-02-05 14:13

    If you want to use $this in libraries, helpers, and access all the methods:

        $this->ci =& get_instance();
        $this->ci->load->database();
    

    You can do also:

        $this->ci->config->item('languages');
    

    or

        $this->ci->load->library('session');
    

提交回复
热议问题