codeigniter 分页类练习
controller page页:
<?php class Blog extends CI_Controller{ public function __construct(){ parent::__construct(); $this->load->library("table"); $this->load->library("pagination"); } public function index(){ $config['base_url']='http://127.0.0.1/CI/index.php/blog/index'; $config['total_rows']=$this->db->get("CI_tb")->num_rows(); $config['per_page']=5; $config['num_links']=15; $this->pagination->initialize($config); // $this->load->model("blogs"); $data['results']=$this->db->get("CI_tb",$config['per_page'],$this->uri->segment(3)); $this->load->view("blogs",$data); } } ?>
view page页:
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <h1>This is test file!</h1> <?php echo $this->table->generate($results); ?> <?php echo $this->pagination->create_links(); ?> </body> </html>
posted on 2013-08-12 16:12 Ijavascript 阅读(289) 评论(0) 收藏 举报
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 编码之道,道心破碎。
· 记一次 .NET 某发证机系统 崩溃分析
· 微服务架构学习与思考:SOA架构与微服务架构对比分析
· tomcat为什么假死了
· 聊一聊 Linux 上对函数进行 hook 的两种方式
· 一周 Star 破万的开源项目「GitHub 热点速览」
· 编码之道,道心破碎。
· 千万级大表,如何做性能调优?
· 不写代码,让 AI 生成手机 APP!保姆级教程
· 知名开源项目Alist被收购!惹程序员众怒,开团炮轰甲方