1 index/Controller/index中的文件,实例如下
public function cpdetail(){
$o = input('ui');
$list = db('tp')->alias('a')
// ->field('a.*,u.id,u.name,s.id,s.name as')字段中名字重复可以换一个名字
->where('a.id','=',$o)
->join('guige u','u.id=a.iid')
->join('leixing s','s.id=a.idd')
->find();
$this->assign('list',$list);
2
$where = []; //随意命名
if (input('?name')) {
$name = input('name');
$where['name'] = ['like', "%$name%"];
}
//分页处理
$list = db('foot2')
->where($where)
->order('id', 'desc')
->paginate(4, false, ['query' => request()->param()]);
$a = $list->items();
$this->assign('list', $a);
$page = $list->render();
$this->assign('page', $page);
return $this->fetch();