标签:控制器 splay 控制 thinkphp pre sign php logs select
控制器中代码:
1 $demo=D(‘demo‘); 2 $count= $demo->count(); 3 $Page= new \Think\Page($count,9); 4 $Page->setConfig(‘header‘, ‘‘); 5 $Page->setConfig(‘prev‘,‘上页‘); 6 $Page->setConfig(‘next‘,‘下页‘); 7 $Page->setConfig(‘first‘,‘首页‘); 8 $Page->setConfig(‘last‘,‘末页‘); 9 // $Page->setConfig(‘theme‘, ‘%FIRST%%UP_PAGE%%LINK_PAGE%%DOWN_PAGE%%END%%HEADER%‘); 10 $show = $Page->show(); 11 $list = $demo->order(‘id‘)->limit($Page->firstRow.‘,‘.$Page->listRows)->select(); 12 $this->assign(‘list‘,$list); 13 $this->assign(‘page‘,$show); 14 $this->display();
模板代码:
<div class="newslist">
<ul>
<foreach name="list" item="it">
<li>
<a href="__URL__/newsshow/id/{$it.id}">{$it.title}</a></li>
</foreach>
</ul>
</div>
<div class="page">
{$page}
</div>
标签:控制器 splay 控制 thinkphp pre sign php logs select
原文地址:http://www.cnblogs.com/lubenxin/p/7083075.html