请高手帮忙详细解释下段代码
public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') 
{
$where = $where && !is_array($where) ? " WHERE $where" : '';
if(is_array($order)) {
$order = '';
}
if($count) {
return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).'  %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
}
return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
}

解决方案 »

  1.   

    public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') 一个数据库搜索函数,可返回总数量参数:$where 同sql  WHERE
             $order 同sql  ORDER
              $start 同sql 从哪一条记录开始返回
              $limit 返回多少条记录
               $count 是否直接返回搜索结果记录条数
                alias 不太明白是个什么作用