Codeigniter - A function for various controllers

Asked

Viewed 67 times

0

I’m using the IC in my projects, but I have a question. I have several controllers that need to access the same api, currently I create the connection with a function called "apicall" in all controllers, and then use it with $this->apicall, what I need to optimize it, making this function apicall ( not only it, but several others that happens the same thing ) be created only once, and be able to use it in other controllers. It is possible to do this in the IC ?

  • Hello, why don’t you use Inheritance to do this?

  • @Ipfranz ended up making a lib, it worked better

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.