For a data Access object example, a friend who learns PHP can refer to the following.
The code is as follows:
<?php/** * Data Access Object Example * * @create_date: 2010-01-04 */class Basedao {var $_db = null; var $_table = NULL; function Basedao ($config) {$this->_db = new MySQLdb ();//cannot be manipulated here}/** * Get processing * * @param array $filter//filter Condition * @p Aram string $field//Get field * @param int $page//Current page * @param int $limit//page */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 (); /** * Common places: * MVC model Layer base class */?>
The above describes the course design instruction format PHP design mode DAO data Access object mode, including the course design specification format content, I hope the PHP tutorial interested in a friend helpful.