php - 集成/迁移两个 CodeIgniter 应用程序。

标签 php .htaccess codeigniter url-routing

我有两个用 CodeIgniter 开发的应用程序,都在不同的服务器上工作,即

www.CI_App_1.com

www.CI_App_2.com

现在我想整合CI_App_2进入CI_App_1申请,所以在那之后我可以调用default_controllerCI_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

https://www.quora.com/Can-I-call-a-controller-function-that-resides-in-another-controller-in-CodeIgniter

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/

相关文章:

javascript - 如何在单击后退按钮时刷新页面?

.htaccess - 如何在整个域上强制重定向 http https

php - 验证未出现

php - 隐藏表单字段不存储变量

php - 将日期保存到 MySQL

mysql - 移动到其他文件夹后 Magento 存储损坏

php - CodeIgniter 中的 Mysql INSERT 和 SELECT

php - mysql 联系人列表查询

php - CodeIgniter:为什么我的唯一表数据数组不包含任何值?

用于提交检查的 PHP isset 函数不起作用