如何从其他Codeigniter调用另一个Codeigniter类/函数

时间:2022-05-15 15:59:34

I want to call A (Codeigniter) login Class and it functions from B Codeigniter. Anyone can explain and share idea how can do this. Thanks

我想调用A(Codeigniter)登录类,它的功能来自B Codeigniter。任何人都可以解释和分享想法如何做到这一点。谢谢

2 个解决方案

#1


0  

This question is similar to:

这个问题类似于:

How to load a controller from another controller in codeigniter?

如何从codeigniter中的另一个控制器加载控制器?

or Codeigniter call function within same class

或同一类中的Codeigniter调用函数

Try this, you will get solution.

试试这个,你会得到解决方案。

#2


0  

<?php 
class MY_Controller extends CI_Controller {
  public function is_logged()
  {}
}

class Home_Controller extends MY_Controller {
    public function show_home()
    {
         if (!$this->is_logged()) {
           return false;
         }
    }
}
?>

#1


0  

This question is similar to:

这个问题类似于:

How to load a controller from another controller in codeigniter?

如何从codeigniter中的另一个控制器加载控制器?

or Codeigniter call function within same class

或同一类中的Codeigniter调用函数

Try this, you will get solution.

试试这个,你会得到解决方案。

#2


0  

<?php 
class MY_Controller extends CI_Controller {
  public function is_logged()
  {}
}

class Home_Controller extends MY_Controller {
    public function show_home()
    {
         if (!$this->is_logged()) {
           return false;
         }
    }
}
?>