fetchColumn();$limit = 10; // 每页显示数量$totalPages = ceil($total / $limit); // 总页数if (isset($_GET['page'])) { $currentPage = $_GET['page'];} else { $currentPage = 1;}$offset =" />
php与ajax分页
278
2024-03-10 01:44
php
query("SELECT count(id) as total FROM table")->fetchColumn();
$limit = 10; // 每页显示数量
$totalPages = ceil($total / $limit); // 总页数
if (isset($_GET['page'])) {
$currentPage = $_GET['page'];
} else {
$currentPage = 1;
}
$offset = ($currentPage - 1) * $limit;
$data = $pdo->query("SELECT * FROM table LIMIT $offset, $limit")->fetchAll();
echo json_encode(array(
'totalPages' => $totalPages,
'data' => $data
));
?>
顶一下
(0)
踩一下
(0)
网站地图
(共30个专题156366篇文章)
返回首页