CodeIgniter帮助 - 在同一应用程序上使用多个数据库,并发出URI路由 [英] CodeIgniter Help - using multiple database on same application and issue with URI Routing

查看:122
本文介绍了CodeIgniter帮助 - 在同一应用程序上使用多个数据库,并发出URI路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小型网络应用程序。在我的申请中,我遵循以下方法。

I am working on a small web application. In my application I follow the following approach.

小于系统上的视图


  1. 应用程序将托管在服务器上(例如)(www.example.com)

  2. 诸如Microsoft,Cocacola,IBM ...等客户端将注册。

  3. 每个客户将有单独的数据库来存储其数据。

  4. 如果客户端的员工想要登录系统,那么url模式应该是这样:
    (www.example.com/ibm/user/login)
    ibm - 是客户端
    用户 - 是控制器
    login - 是用户控制器的方法

  1. The Application will be hosted on the server for example (www.example.com )
  2. Clients such as Microsoft, Cocacola, IBM.... etc will sign up. And the clients will access the application by using url like this ( www.example.com/ibm )
  3. Each client will have separate database to store their data.
  4. If the employees of the client want to login into the system then the url pattern should be like this : (www.example.com/ibm/user/login) ibm - is the client user - is controller login - is method of user controller

如何实现?

How to achieve this?

提前感谢

推荐答案

为您的建议。


  1. 在您的文本中打开系统/ core / router.php

  2. 转到第264行... function _validate_request($ segments)

  3. 用$ segments替换$ segments [ ]
    OR

  4. 在第270行添加此代码

  1. Open system/core/router.php in your text editor.
  2. Go to Line number 264 .... function _validate_request($segments)
  3. Replace $segments[0] with $segments[1] OR
  4. Add this code at line 270

$ x = $ segments;
$ a = 1;
for($ i = 0; $ i<(count($ segments)-1); $ i ++)
{
$ segments [$ i] = $ x [$ a]
$ a ++;
}

$x=$segments; $a=1; for($i=0;$i<(count($segments)-1); $i++) { $segments[$i]=$x[$a]; $a++; }

这篇关于CodeIgniter帮助 - 在同一应用程序上使用多个数据库,并发出URI路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆