+ -
当前位置:首页 → 问答吧 → 分页问题

分页问题

时间:2011-04-29

来源:互联网

控制器中代码:
  1. public function index(){
  2. $Form = M("Form");

  3. import("@.ORG.Page"); //导入分页类
  4. $count = $Form->count(); //计算总数
  5. $p = new Page( $count, 5 );
  6. $list=$Form->limit($p->firstRow.','.$p->listRows)->order('id desc')->findAll();
  7. $page = $p->show ();
  8. $this->assign ( "page", $page );


  9. $list=$Form->limit(5)->order('id desc')->findAll();

  10. $this->assign('list',$list);
  11. $this->display();
  12. }
复制代码
但是从入口文件进去却报错:
Fatal error: Class 'Page' not found in D:\PHPnow\htdocs\thinkphp\test\Lib\Action\IndexAction.class.php on line 11

作者: carrot   发布时间: 2011-04-29

导入路径不对吧

作者: ck52110u   发布时间: 2011-04-29

修改为:import("ORG.Util.Page");
或:将分页类拷贝到当前项目Lib\ORG目录下。

作者: hbolive   发布时间: 2011-04-29