Database layer in Zend

来源:互联网 发布:水雷的点云数据 编辑:程序博客网 时间:2024/05/17 18:18

When we want to use database, we needs some connection parameters to get the connection. It can be from configuration file like application.ini or variable declared in the php file.

db.adapter = PDO_MYSQLdb.config.host = localhostdb.config.username = rootdb.config.password =db.config.dbname = griddb.config.profiler = false;
After we configure the connection information, we can use Zend_Db to set up the connection.

$db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());Zend_Db_Table::setDefaultAdapter($db);