我有两个用 CodeIgniter 开发的应用程序,都在不同的服务器上工作,即
www.CI_App_1.com
和
www.CI_App_2.com
现在我想整合CI_App_2
进入CI_App_1
申请,所以在那之后我可以调用default_controller
的 CI_App_2
来自 CI_App_1
的链接之一.
我的文件夹结构:
htdocs :
-application_1
-application
-application_2
-application
-config
-autoload.php
-config.php
-routes.php
-controllers
-app_2_controller.php
-helpers
-libraries
-models
-app_2_model.php
-views
-app_2_view.php
-system
-.htaccess
-index.php
-config
-autoload.php
-config.php
-routes.php
-controllers
-app_1_controller.php
-helpers
-libraries
-models
-app_1_model.php
-views
-app_1_view.php
-system
-.htaccess
-index.php
我想在用户从 CI_App_1
登录后访问 CI_App_2 .验证流程用户后可以访问我的 CI_App_2
只是,如果用户尝试在不进行身份验证的情况下访问它,则会收到一条错误消息:
Access forbidden
我提到了以下链接:
Call Controller method of CodeIgniter outside Application directory
CodeIgniter: Load controller within controller
How to load a controller from another controller in codeigniter?
Codeigniter : calling a method of one controller from other
http://www.techsirius.com/2013/01/load-controller-within-another.html
http://www.devnetwork.net/viewtopic.php?f=72&t=131353
how to set up two codeigniter applications running on same server
https://www.codeigniter.com/user_guide/general/managing_apps.html
但在上面的链接中,他们说应该使用 HMVC 模块结构来完成,但没有人提到两个 Controller 文件来自相同的应用程序或不同的应用程序。我想访问 default_controller
从第二个应用程序到第一个应用程序。
这可能吗?
感谢任何形式的帮助。提前致谢。希望你能回答我的问题。
最佳答案
在 application_1 default_controller 上设置的以下函数可能是它的工作。
public function _remap($method) {
$userdata = $this->session->userdata('user');
if (!empty($userdata)) {
modules::run('application_2/controller/default_controller');
}
}
关于php - 集成/迁移两个 CodeIgniter 应用程序。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42133984/