首页 > 代码库 > thinkphp 原生sql使用分页类

thinkphp 原生sql使用分页类

public function index(){import("@.ORG.Page");       //导入分页类$Dao = M();$count = count($Dao->query("SELECT * FROM ofuser WHERE uid IN (SELECT uid FROM ofid WHERE uid =‘1‘)"));//总计条数$Page = new Page($count, 10); //一页中的数量为5$list = $Dao->query("SELECT * FROM ofuser WHERE uid IN (SELECT uid FROM ofid WHERE uid =‘1‘) limit $Page->firstRow,$Page->listRows");//根据上面的条件进行查询$Page->parameter    =   ‘search=key&name=thinkphp‘;//parameter参数        // 设置分页显示$Page->setConfig(‘header‘, ‘条数据‘);//页面显示为:6条数据        $Page->setConfig(‘first‘, ‘<<‘);        $Page->setConfig(‘last‘, ‘>>‘);        $page = $Page->show();        $this->assign("page", $page);        $this->assign("list", $list);        $this->display();        //dump($list);        echo $_SESSION[‘uid‘];//显示验证码的SESSION值";        }

 

thinkphp 原生sql使用分页类