CodeIgniter calling model on view?

前端 未结 5 1804
暗喜
暗喜 2021-01-06 01:26

I have a view which comport a table of data, this data is generated on a model. How can I call this model in my view to be posted on my view...? That\'s the Equivalent of wh

5条回答
  •  伪装坚强ぢ
    2021-01-06 01:57

    try using $CI =& get_instance()

    then load your model like this:

    $CI->load->model('someModel')

    then call your model function like this:

    $result = $CI->someModel->somefunction()

    then display using foreach

    foreach($result as $row){ $row->somecolumnName }

提交回复
热议问题