phalconeye
如何在phalcon框架中连接多个数据库(How to connect multiple database in phalcon framework)
问题 我必须建立数据库,即 master 和 xyz,因为我需要在应用程序中连接这两个数据库。 那么是否可以在一个应用程序中连接多个数据库,是的,那么如何。? 回答1 在 DI 中设置您的连接: //This service returns a MySQL database $di->set('dbMaster', function() { return new \Phalcon\Db\Adapter\Pdo\Mysql(array( "host" => "localhost", "username" => "", "password" => "", "dbname" => "" )); }); //This service returns a PostgreSQL database $di->set('dbSlave', function() { return new \Phalcon\Db\Adapter\Pdo\Mysql(array( "host" => "localhost", "username" => "", "password" => "", "dbname" => "" )); }); 在您的模型中选择连接: public function initialize() { $this->setConnectionService('dbMaster'); //or
2021-08-30 05:46:50 分类:技术分享 phalcon phalconeye
How to connect multiple database in phalcon framework
i have to database namely master and xyz ,in that i required to connect both database in application . so is it possible to connect multiple database in one application and yes then how.?
2021-06-25 00:19:19 分类:问答 phalcon phalconeye