Common functions in CodeIgniter

倾然丶 夕夏残阳落幕 提交于 2019-12-02 13:23:20

You can easily achieve that by using core controllers: http://ellislab.com/codeigniter/user-guide/general/core_classes.html

Instead of beginning your model with:

class Some_model extends CI_Model {}

You start with:

class Some_model extends MY_Model {}

Edit: It is also possible to use libraries: http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html

This is useful when you want more general things, like a search engine, a IMAP interface, that kind of stuff.

if your creating your own model first make sure it is inside the core folder second on your controller extends the model name like this

class myController extends Locaton_model {

function index()
{
$this->load->model->("your model name");
$this->yourmodelname->functionname($param);
}

}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!