Home >Backend Development >PHP Tutorial > zendframework的DB连接使用,该怎么处理

zendframework的DB连接使用,该怎么处理

WBOY
WBOYOriginal
2016-06-13 12:55:19830browse

zendframework的DB连接使用
现在我想实现的是,初次登陆时,就进行DB连接,然后以后再读取数据库的时候就不用再连接了,Zend_Registry是怎么使用的。
求救!!!!谢谢
------解决方案--------------------
class Db
{
public static function conn()
{
$connParams=array("host"=>"localhost",
       "port"=>"3306",
       "username"=>"root",
                               "password"=>"",
                               "dbname"=>"");
             $db=new Zend_Db_Adapter_Pdo_Mysql($connParams);
             return $db;
}
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn