Dao.php
656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/4/6
* Time: 下午3:06
*/
namespace QSns;
use Hood\DB;
class Dao
{
protected $key = '';
/**
* @var \Hood\Dao\Db\PDOMySQL\Quick
*/
private $_dao = null;
private $dbName = '';
public function __construct($dbName = 'buysns')
{
$this->key = $this->dbName = Config::DB_PREFIX . $dbName;
}
/**
* @param string $database
* @return \Hood\Dao\Db\PDOMySQL\Quick
*/
protected function dao()
{
if ($this->_dao == null) {
$this->_dao = DB::Quick($this->dbName);
}
return $this->_dao;
}
}