我已经学习了CodeIgniter的基础知识,现在正在学习模块。
我的问题:我在模块文件夹中创建了两个文件夹,
在
first_module
和second_module
。在
first_module
文件夹中的控制器中,我的代码是:<?php
class First_module extends MX_Controller {
public function index()
{
$this->load->view('first_module_view');
}
}
?>
first_module_view
页面代码:
<html>
<body>
<h1> hey this is first module </h1>
<?php
echo Modules::run('second_module/second_module');
?>
</body>
</html>
second_module
控制器页面:
<?php
class Second_module extends MX_Controller {
public function index()
{
$this->load->view('second_module_view');
}
}
?>
second_module_view
页面:
<html>
<body>
<h1> hey this is second module </h1>
</body>
</html>
我试图使用第二模块的控制器部分查看first_module
视图中的第二模块视图,但这并没有起作用。
单独地,两个代码都可以正常工作,但Modules::run()
似乎不起作用。
我是否遗漏了什么?
$config['modules_locations'] = array( APPPATH.'modules/' => '../modules/', );
。 - avinashseecho Modules::run('second_module/second_module');
中没有包含索引。以下代码可以正确执行:echo Modules::run('second_module/second_module\index');
- avinashse