本文介绍了访问模型从codeigniter中的视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
在控制器上加载模型
p> $ this-> load-> model('yourmodel');将此模型分配给这样的变量
$ data ['model_obj'] = $ this-> yourmodel;并将此数据数组分配给视图模板
在视图模板上使用$ model_obj对象调用模型方法
$ model_obj-> some_method b希望这有助于...
can anyone tell me how do i access model from view in codeigniter?
解决方案Load a model on the controller
$this->load->model('yourmodel');Assign this model to a var like this
$data['model_obj'] = $this->yourmodel;and assign this data array to your view template
Use $model_obj object on the view template for calling model methods
$model_obj->some_method()Hope this helps ...
更多推荐
访问模型从codeigniter中的视图?
发布评论