DB Join for Zendframework use

Source: Internet
Author: User
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.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.