开发者

codeigniter single application multiple databases

开发者 https://www.devze.com 2023-02-21 16:44 出处:网络
I will be shifting my code base to the new 2.0 framework and just had a few questions on the following points

I will be shifting my code base to the new 2.0 framework and just had a few questions on the following points

My urls will be as follows

I would like to know what would be the best way to switch the database based on the city in the url? .

In my webroot i will have directories like city1, city2 each containing an index.php file which points to the single code base.

Now i only need a way to switch the database based on the url entered.

Regards, Sheldon


I completely agree with @poelinca and @Ross, you should definitely consider rethinking your design.

however for reference issues this topic was already covered in the CodeIgniter forums pretty well over here

Basically you just configure another set of $db items per connection and then request the connection based on those configuration parameters by the CodeIgniter framework, by providing the new $db as a parameter for the DB class constructor.

0

精彩评论

暂无评论...
验证码 换一张
取 消