Codeigniter : calling a method of one controller from other

后端 未结 10 1940
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-05 01:48

I have two controllers a and b.

I would like to call a method of controller a from a method of controller b.

10条回答
  •  时光说笑
    2020-12-05 02:27

    You can use the redirect() function. Like this

    class ControllerA extends CI_Controller{
        public function MethodA(){
           redirect("ControllerB/MethodB");
        }
    }
    

提交回复
热议问题