The FuelPHP documentation does not include information on how to use the DB class to specify connections, which would allow me to then control multiple database connections. Any idea on how to accomplish this? Google search shows evidence of a Database_Connection class, but no information on how it might be used.

有帮助吗?

解决方案

First place to start would be reading https://github.com/fuel/core/blob/1.1/master/classes/database/connection.php .. It looks like you will have to write something similar to:

$db2 = DB::instance( 'second_connection' );

Where second_connection is configured as per example : http://fuelphp.com/docs/classes/database/introduction.html

When you first time you execute that function, it will create new instance. Afterwards when you use the same line , it will just pick opened connection from the registry .. Essentially, it's same old procedural code with global array of DB connections, just wrapped in fake OO code.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top