zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    Easy Code 自定义的模板
    LINUX批量修改文件名
    解决FTP登录太慢
    linux 命令
    Linux rename命令
    MySQL字段重复出现多少次
    kafka安装
    Redis 5.0简单安装
    Tomcat常用配置
    jenkins安装和简单配置
  • 原文地址:https://www.cnblogs.com/wangwenfei/p/php_ci.html
Copyright © 2011-2022 走看看