如果使用 Zend_Json 放設定檔,這「可能」是一個比較好的解法:
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);
}
0 Responses to “Zend_Json + Zend_Config + Zend_Db”