2010-06-28 49 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); 
相关问题