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_MYSQL
db.config.host = localhost
db.config.username = root
db.config.password =
db.config.dbname = grid
db.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);
本文介绍如何设置Zend_Db数据库连接参数。通过配置文件或PHP变量指定数据库适配器、主机名、用户名、密码及数据库名称等信息。配置完成后,利用Zend_Db工厂方法建立连接,并设置默认适配器。

被折叠的 条评论
为什么被折叠?



