<?php namespace Admin\Controller; use Think\Controller; class ArticleController extends Controller { public function lst(){ $article = D('ArticleView'); $count = $article->count();// 查詢滿足要求的總記錄數(shù) $Page = new \Think\Page($count,5);// 實(shí)例化分頁(yè)類 傳入總記錄數(shù)和每頁(yè)顯示的記錄數(shù) $show = $Page->show();// 分頁(yè)顯示輸出 $list = $article->order('id asc')->limit($Page->firstRow.','.$Page->listRows)->select(); $this->assign('list',$list);// 賦值數(shù)據(jù)集 $this->assign('page',$show);// 賦值分頁(yè)輸出 $this->display(); }
<?php namespace Admin\Model; use Think\Model\ViewModel; class ArticlViewModel extends ViewModel { }
報(bào)錯(cuò)
1146:表 'tk_blog.blog_article_view' 不存在 [ SQL 語(yǔ)句 ] : SHOW COLUMNS FROM `blog_article_view`