我有自己的mysql_connect ...etc,直到我想使用ZEND框架,特别是在Zend_DB .How中,我是否将我的连接作为适配器传递给ZEND?
$myconn = mysql_connect('...blab',blah etc...)
eg. Zend_DB_table::setAdapter($myconn);发布于 2010-02-06 19:27:08
不要自己连接到数据库,而是使用工厂
$db = Zend_Db::factory('Pdo_Mysql', array(
'host' => '127.0.0.1',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname' => 'test'
));通过这种方式,您可以连接到数据库,但它只会在您需要连接时连接,从而优化性能……
https://stackoverflow.com/questions/2191644
复制相似问题