I'm developing an application, where the same function I'm writing for some controllers. So I wanted one common function for all controllers. Please help me out I've stucked up with this. The work would be more appreciated.
相关问题
- Keeping track of variable instances
- How to get the maximum of more than 2 numbers in V
- F#: Storing and mapping a list of functions
- VBA Self-Function returns #VALUE! Error on cell, w
- How to use strip_tags with second parameter in Cod
相关文章
- 关于Asp.net Mvc Core重写Initialize方法的问题
- Spring: controller inheritance using @Controller a
- Accessing an array element when returning from a f
- Private static variables in php class
- Equivalent to window.setTimeout() for C++
- How can I write-protect the Matlab language?
- Java Equivalent to iif function
- Disable action method from being called from the a
You can develop a helper or library.
codeigniter version 2 : https://codeigniter.com/userguide2/general/creating_libraries.html
codeigniter version 3 : https://codeigniter.com/user_guide/general/creating_libraries.html?highlight=library
You can create
MY_Controller
class inapplication/core
Now extend every class with
MY_Controller
and the function will be available for each classWhen in the url you call
This will work.
create a model class and create that all function after that extend that model all model classes .you can use one function different controller.other wise you can use Cms helper.this is the best way call a common function in different controller.