westdc-zf1/vendor/Sookon/Helpers/Db.php

30 lines
731 B
PHP

<?php
namespace Sookon\Helpers;
use Zend\Config\Config as Zend_Config;
class Db extends \Zend\Db\Adapter\Adapter
{
private $debug = 0; //调试模式
private $config_local_path = "config/autoload/local.php";
function __construct(&$db,$param = array())
{
$config_local = new Zend_Config(include $this->config_local_path);
if(is_array($param) && count($param)>0)
{
$db = new \Zend\Db\Adapter\Adapter($param);
}else{
$db = new \Zend\Db\Adapter\Adapter(array(
'driver' => $config_local->db->driver,
'hostname' => $config_local->db->hostname,
'database' => $config_local->db->database,
'username' => $config_local->db->username,
'password' => $config_local->db->password
));
}
}
}