标签:
<?php
class Database {
private $sql;
public function where($where) {
$this->sql .= " where {$where}";
return $this;
}
public function order($order) {
$this->sql .= " order by {$order}";
return $this;
}
public function limit($limit) {
$this->sql .= " limit ({$limit})";
return $this;
}
public function go() {
return $this->sql;
}
}
$db = new Database();
$stmt = $db->where(‘id=1 and name=2‘)->order(‘id DESC‘)->limit(10)->go();
?>
标签:
原文地址:http://www.cnblogs.com/redasurc/p/4694187.html