public function index() {
$p=(int)$_GET['p'];
import ( 'ORG.Util.Page' );
$order=$_GET['order'];
if ($order) {
$map['title'] = array('like','%$order%');
}
$result = M ( "content" )->where($map)->page($p.',20')->order('id desc')->select ();
$count = M ( "content" )->where($map)->count (); // 查询满足要求的总记录数
$Page = new Page ( $count, 20); // 实例化分页类 传入总记录数和每页显示的记录数
$Page -> setConfig('header', '条记录');
$Page -> setConfig('theme', '<li><a>%totalRow% %header%</a></li> <li>%upPage%</li> <li>%downPage%</li> <li>%first%</li> <li>%prePage%</li> <li>%linkPage%</li> <li>%nextPage%</li> <li>%end%</li> ');//(对thinkphp自带分页的格式进行自定义)
$show = $Page->show (); // 分页显示输出
$this->assign ( "result", $result );
$this->assign ( "page", $show ); // 赋值分页输出
$this->display ();
}模糊搜索这里哪儿写的不对呢? 最佳答案