复制代码
5,view模板部分:模板index.html页面如下:
验证码:
复制代码
6,控制器:控制器useraction.class.php如下:
//验证码验证if($_session['verify']!=md5($_post['verify'])){ $this->error('验证码不正确'); }
复制代码
二、分页:1,导入分页类,在aoli\thinkphp\lib\org\util\page.class.php里有验证码方法 2,action部分:useraction.class.php页面:
function index(){ import('org.util.page');//引入分布类 $user=m('user'); $count=$user->count(); $page=new page($count,3);//一页显示5条 $page->setconfig('theme','总共:%totalrow%%header% %nowpage%/%totalpage%页 %first% %uppage% %prepage% %linkpage% %nextpage% %downpage% %end%
'); $show=$page->show(); $list=$user->field(array('id','username','createip'))->order('id desc')->limit($page->firstrow.','.$page->listrows)->select(); $this->assign('alist',$list); $this->assign('page',$show); $this->display();}
复制代码
3,view模板部分:模板页index.html页面:
id:{$vo['id']}用户名:{$vo['username']}注册ip:{$vo['createip']}删除 编辑{$page}
复制代码
以上就是本节介绍的thinkphp验证码与分页实例,希望对大家有所帮助。