复制代码 代码如下:
/**
* Data Access Object Example
*
* @create_date: 2010-01-04
*/
class BaseDAO
{
var $_db = null;
var $_table = null;
function BaseDAO($config)
{
$this->_db = new MysqlDB(); // 这里的不能进行操作
}
/**
* Get processing
*
* @param array $filter // Filter condition
* @param string $field // Get field
* @param int $page // Current page
* @param int $limit // Number of pages
*/
function fetch($filter = array(),$field = "*",$page = 1,$limit = null)
{
$this->_db->select($filed)->from($this->_table)->where($filter)->limit($page,$limit);
return $this->_db->execute();
}
function update(){}
function delete(){}
function insert(){}
}
class MemberDAO extends BaseDAO
{
var $_table = "member";
}
$oMember = new MemberDAO();
$oMember->fetch();
/**
* Commonly used places:
* Model layer base class in MVC
*/
?>
http://www.bkjia.com/PHPjc/323783.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323783.htmlTechArticle复制代码 代码如下: ?php /*** Data Access Object (Data Access Object) Example * * @create_date: 2010-01-04*/ class BaseDAO { var $_db = null; var $_table = null; function Ba...