加入收藏 | 设为首页 | 会员中心 | 我要投稿 南通站长网 (https://www.0513zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 编程要点 > 语言 > 正文

php分页功能怎么办?详解php封装实现实例

发布时间:2022-04-14 13:42:01 所属栏目:语言 来源:互联网
导读:我们在做开发的时候,如果数据太多就会使用分页功能。下面小编就给大家分享一个使用php封装实现的page分页类,感兴趣的朋友可以了解一下,下面是实现效果。 1.测试实例test.php ?php header(Content-Type: text/html; charset=utf-8); date_default_timezone
       我们在做开发的时候,如果数据太多就会使用分页功能。下面小编就给大家分享一个使用php封装实现的page分页类,感兴趣的朋友可以了解一下,下面是实现效果。
  
       1.测试实例test.php
 
<?php
header("Content-Type: text/html; charset=utf-8");
date_default_timezone_set("Asia/Shanghai"); //时区
 
require_once('page.class.php');
 
$showrow = 5;
$curpage = empty($_GET['page']) ? 1 : $_GET['page'];
$url = "?page={page}";
$dsn = 'mysql:host=xxx.xxx.80.xxx;dbname=admin';
$pdo = new PDO($dsn, 'root', 'root');
$pdo->query('set names utf8');
$sql = "SELECT * from operator_list where 1=1";
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title></title>
 <meta name="keywords" content="入库"/>
 <meta name="description" content="入库"/>
 <script type="text/javascript" src="static/js/jquery-1.11.0.min.js?v=1"></script>
 <link rel="stylesheet" type="text/css" href="static/css/common.css" rel="external nofollow" />
</head>
<body>
<div class="head">
 <!-- <div class="head_inner clearfix">-->
 <!--  <ul id="nav">-->
 <!--   <li><a href="javascript;" rel="external nofollow" rel="external nofollow" >商品列表</a></li>-->
 <!--   <li><a href="javascript;" rel="external nofollow" rel="external nofollow" >详情列表</a></li>-->
 <!--  </ul>-->
 <!--    <a class="logo" href="javascript" rel="external nofollow" >
      <img src="javascript;" alt="公司logo" /></a> -->
 <!-- </div>-->
</div>
<div class="container">
 <div class="demo">
  <h2 class="title">报表</h2>
 
    if (!empty($result)) {
     foreach ($result as $k => $v) {
      ?>
      <tr align="center">
       <td><?php echo $v['id']; ?></td>
       <td><?php echo $v["customer_id"]; ?></td>
       <td><?php echo $v["name"]; ?></td>
       <td><?php echo $v["role_id"]; ?></td>
       <td><?php echo $v["status"]; ?></td>
       <td><?php echo $v["cdate"]; ?></td>
      </tr>
      <?php

(编辑:南通站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读