Zend_Json + Zend_Config + Zend_Db

如果使用 放設定檔,這「可能」是一個比較好的解法:

public function __construct()
{
    $j = file_get_contents(dirname(__FILE__) . '/db.json');
    $conf = Zend_Json::decode($j);
    $conf = new Zend_Config($conf['Db']);
    $this->rDb = Zend_Db::factory($conf->rDb);
    $this->wDb = Zend_Db::factory($conf->wDb);
}

參考:

This entry was posted in Computer, Database, Murmuring, Network, Programming, Software, WWW. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *