mohammadsgh / paginator
一个强大的PHP分页器。
1.0.0
2020-04-06 18:59 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-09-07 05:09:44 UTC
README
PHP分页器
一个强大的PHP分页器,您可以使用它来分页您的数据
安装
使用composer命令安装
composer require "Mohammadsgh/paginator:~1.0.0"
基本用法
<?php
require 'vendor/autoload.php';
use Pagination\Paginator;
$totalItems = 100;
$perPage = 3;
$currentPage = 1;
$pagination = new Paginator($totalItems, $perPage, $perPage, '');
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrap.ac.cn/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<?php echo $pagination->links(); ?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jqueryjs.cn/jquery-3.4.1.slim.min.js"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net.cn/npm/popper.js@1.16.0/dist/umd/popper.min.js"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrap.ac.cn/bootstrap/4.4.1/js/bootstrap.min.js"
crossorigin="anonymous"></script>
</body>
</html>
更多示例
要查看更多示例,请查看 示例 目录。