function __construct() { parent::__construct(); // echo $this->CONFIG[]; $LiDb = new LDb(); $this->ObDb = $LiDb->ObDb; // $this->ObDb->hello(); }
public function __construct() { if ($this->ObDb) { return $this->ObDb; } parent::__construct(); // print_r($this->CONFIG); $conn = mysql_connect($this->CONFIG['db_host'], $this->CONFIG['db_user'], $this->CONFIG['db_psw']) or die('error'); mysql_select_db($this->CONFIG['db_name']) or die("数据库不存在或不可用"); mysql_query('set names ' . $this->CONFIG['db_charset'], $conn); // print_r($conn); return $this->ObDb = $conn; }