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 admin
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%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片

网站地图 (共30个专题156366篇文章)

返回首页