单条数据查询
~~~
$info = Db::name('goods')->where(["catid" => '45'])->find();
~~~
查询多个数据(数据集)使用select方法:
~~~
$cpflid = '19';
$category_arr = Db::name('category')->where(['parentid' => $cpflid])->select();
~~~
列表数据查询
~~~
// 排序规则
if ($_G['sort']=='1'){
$order_sz1 = 'id';
$order_sz2 = 'desc'; //最大的靠前
}else{
$order_sz1 = 'time_expire_c';
$order_sz2 = 'asc'; //最小的靠前
}
// 查询条件
if ($_G['order_id']){
$where_lb = [
'order_id' => $_G['order_id'],
];
}else{
$where_lb = [
'uid'=>$_W['mc_uid'],
];
}
$list = Db::name('order')->order($order_sz1,$order_sz2)->where($where_lb)->paginate(12);
~~~