CodeIgniter帮助 - 在同一应用程序上使用多个数据库,并发出URI路由 [英] CodeIgniter Help - using multiple database on same application and issue with URI Routing
本文介绍了CodeIgniter帮助 - 在同一应用程序上使用多个数据库,并发出URI路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个小型网络应用程序。在我的申请中,我遵循以下方法。
I am working on a small web application. In my application I follow the following approach.
小于系统上的视图
- 应用程序将托管在服务器上(例如)(www.example.com)
- 诸如Microsoft,Cocacola,IBM ...等客户端将注册。
- 每个客户将有单独的数据库来存储其数据。
- 如果客户端的员工想要登录系统,那么url模式应该是这样:
(www.example.com/ibm/user/login)
ibm - 是客户端
用户 - 是控制器
login - 是用户控制器的方法
- The Application will be hosted on the server for example (www.example.com )
- 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 )
- Each client will have separate database to store their data.
- 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?
提前感谢
推荐答案
为您的建议。
- 在您的文本中打开系统/ core / router.php
- 转到第264行... function _validate_request($ segments)
- 用$ segments替换$ segments [ ]
OR -
在第270行添加此代码
- Open system/core/router.php in your text editor.
- Go to Line number 264 .... function _validate_request($segments)
- Replace $segments[0] with $segments[1] OR
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屋!
查看全文