Zendframework DB connection using the
Now I want to realize that, when the first landing, the DB connection, and then read the database later when it is no longer connected, zend_registry is how to use.
Distress!!!! Thank you
------Solution--------------------
Check out the Zend Framework Handbook
Resources
http://blog.csdn.net/cfchengfei002/article/details/7354153
------Solution--------------------
PHP Code
config.ini[general]db.adapter=pdo_mysqldb.config.host=localhostdb.config.username=rootdb.config.password= 123456db.config.dbname=test$config=new Zend_config_ini ('./application/config/config.ini ', NULL, true); Zend_registry::set (' config ', $config); $db =zend_db::factory ($config->general->db->adapter, $config General->db->config->toarray ()); $db->query (' SET NAMES UTF8 '); Zend_db_table::setdefaultadapter ($DB); Zend_registry::set (' db ', $db);
------Solution--------------------
You don't want to use zend_registry to achieve this. Because this is only valid in a single request, you have to implement login to save the data and so on honestly use the session.