🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### index基础函数 > 可以仿照为base,其他根据需求更改 ```php public function index() { if (Request::isPost()) { // 关键词查询 $keys = $this->request->post('keys', '', 'trim'); $where = []; if ($keys != '') { $where[] = ['title', 'like', '%' . $keys . '%']; } // 分页 $page = $this->request->post('page'); $limit = $this->request->post('limit'); $tol = ($page - 1) * $limit; // 查询需要展示的数据 $banner = BannerModel::where($where)->limit($tol, $limit)->select(); $count = BannerModel::where($where)->count(); if (!$banner) $this->errorMsg(); $this->successMsg($banner, $count); } return view(); } ```