如何在codeigniter中一个接一个地调用两个控制器

时间:2014-02-17 08:11:10

标签: codeigniter

我们必须从另一个控制器类加载两个控制器。

来源是这样的:

   public function index()
{


             /** Laodning the Twitter Controller for the Twitter Feed **/

            $this->load->controller('twitter', 'twitter_controller');
            $data['twitter_feed'] = $this->twitter_controller->fetchAll();

            echo '<pre>';
                print_r($data['twitter_feed']);
            echo '</pre>';


            /** Loading the News Controller to get the Latest News **/

            $this->load->controller('news', 'news_controller');
            $data['news'] = $this->news_controller->get_latest_news();

Twitter控制器正在加载,但无法加载新闻控制器。

1 个答案:

答案 0 :(得分:0)

您可以使用重定向功能,尝试

redirect("controller_name/function_name","refresh");//this code is using header function of php, it simple get the base_url+1st parameter.

希望这会对你有所帮助

相关问题