在每个函数实现业务逻辑后,使用return $this;
<?php
namespace IMooc;

class Database
{
function where($where)
{
return $this;
}

function order($order)
{
return $this;
}

function limit($limit)
{
return $this;
}
}

$db = new IMooc\Database();
$db->where("id=1")->where("name=2")->order("id desc")->limit(10);
//$db->where("id=1");
//$db->where("name=2");
//$db->order("id desc");
//$db->limit(10);




相关文章: