2010-06-28 86 views
2

林使用HMVC擴展使用CodeIgniter CodeIgniter的我得到了使用$this->load->model('person_model')頭版控制器內2個模塊如何從另一個模塊加載模型

modules/frontpage 
    -- controllers 
    frontpage.php (<- this controller needs to load the person model) 
    -- models 
    -- views 
modules/person 
    -- controllers 
    -- models 
    person_model.php (defines Person_Model extends Model) 
    -- views 

似乎只加載包含在同一模塊中的全局或模型(首頁模型)。

任何CodeIgniter的專家在這裏?

回答

12

發現它......這是一個簡單的修復。

就不得不使用:$this->load->model('person/person_model');

0

從我的笨的另一個版本體驗,加載模型的正確方法是 $這個 - >負載>模型($模式=「人」,$模塊='person');

0
$rand=rand(1,9999999); 
$currentModel="currentModel".$rand; 
$this->load->model($call_model,$currentModel); 
$call_method=$method;    
$currentMod=$currentModel; 
$CI =& get_instance(); 
$re_data= $CI->$currentMod->$call_method($paramArr); 
相關問題