欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php設(shè)計模式 DAO(數(shù)據(jù)訪問對象模式)

 更新時間:2011年06月26日 11:23:20   作者:  
數(shù)據(jù)訪問對象(Data Access Object) 示例 ,學(xué)習(xí)php的朋友可以參考下。
復(fù)制代碼 代碼如下:

<?php
/**
* 數(shù)據(jù)訪問對象(Data Access Object) 示例
*
* @create_date: 2010-01-04
*/

class BaseDAO
{
var $_db = null;
var $_table = null;

function BaseDAO($config)
{
$this->_db = new MysqlDB(); // 這里的不能進(jìn)行操作
}

/**
* 獲取處理
*
* @param array $filter // 過濾條件
* @param string $field // 獲取字段
* @param int $page // 當(dāng)前頁
* @param int $limit // 頁數(shù)
*/
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();

/**
* 常用到的地方:
* MVC中model層基類
*/
?>

相關(guān)文章

最新評論