函数代码详细求解

原创
2016-06-23 14:13:34 781浏览

请高手帮忙详细解释下段代码
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));
}


回复讨论(解决方案)

那里不清楚你可以标出来

都不清楚哟

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 不太明白是个什么作用

不简单看到条正儿八经的的回复

楼上+1

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。