<legend id='GonTD'><style id='GonTD'><dir id='GonTD'><q id='GonTD'></q></dir></style></legend>

      <small id='GonTD'></small><noframes id='GonTD'>

    1. <i id='GonTD'><tr id='GonTD'><dt id='GonTD'><q id='GonTD'><span id='GonTD'><b id='GonTD'><form id='GonTD'><ins id='GonTD'></ins><ul id='GonTD'></ul><sub id='GonTD'></sub></form><legend id='GonTD'></legend><bdo id='GonTD'><pre id='GonTD'><center id='GonTD'></center></pre></bdo></b><th id='GonTD'></th></span></q></dt></tr></i><div id='GonTD'><tfoot id='GonTD'></tfoot><dl id='GonTD'><fieldset id='GonTD'></fieldset></dl></div>

      <tfoot id='GonTD'></tfoot>

        • <bdo id='GonTD'></bdo><ul id='GonTD'></ul>

        没有 SQL 的 PHP 动态分页

        时间:2023-09-24
      1. <small id='aBdCB'></small><noframes id='aBdCB'>

            <tbody id='aBdCB'></tbody>
        1. <i id='aBdCB'><tr id='aBdCB'><dt id='aBdCB'><q id='aBdCB'><span id='aBdCB'><b id='aBdCB'><form id='aBdCB'><ins id='aBdCB'></ins><ul id='aBdCB'></ul><sub id='aBdCB'></sub></form><legend id='aBdCB'></legend><bdo id='aBdCB'><pre id='aBdCB'><center id='aBdCB'></center></pre></bdo></b><th id='aBdCB'></th></span></q></dt></tr></i><div id='aBdCB'><tfoot id='aBdCB'></tfoot><dl id='aBdCB'><fieldset id='aBdCB'></fieldset></dl></div>
          <legend id='aBdCB'><style id='aBdCB'><dir id='aBdCB'><q id='aBdCB'></q></dir></style></legend>
            <bdo id='aBdCB'></bdo><ul id='aBdCB'></ul>

                <tfoot id='aBdCB'></tfoot>

                  本文介绍了没有 SQL 的 PHP 动态分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个脚本可以动态调用和显示目录中的图像,对它进行分页的最佳方法是什么?我希望能够通过脚本中的变量控制每页显示的图像数量.我正在考虑使用 URL 变量(即 - http://domain.com/page.php?page=1) 但我不确定如何去做.

                  I've got a script that dynamically calls and displays images from a directory, what would be the best way to paginate this? I'd like to be able to control the number of images that are displayed per page through a variable within the script. I'm thinking of using URL varriables (ie - http://domain.com/page.php?page=1) but am unsure how to go about this.

                  感谢您的帮助.

                  推荐答案

                  分页是同一个概念,不管有没有 sql.你只需要你的基本变量,然后你就可以创建你想要的内容.这是一些准代码:

                  pagination is the same concept with or without sql. you just need your basic variables, then you can create the content you want. here's some quasi-code:

                  $itemsPerPage = 5;
                  
                  $currentPage = isset($_GET['page']) ? $_GET['page'] : 1;
                  $totalItems = getTotalItems();
                  $totalPages = ceil($totalItems / $itemsPerPage);
                  
                  function getTotalItems() {
                  // since they're images, perhaps we'll scan a directory of images to determine
                  // how many images we have in total
                  }
                  
                  function getItemsFromPage($page, $itemsPerPage) {
                  // function to grab $itemsPerPage based on which $page we're on
                  }
                  
                  function getPager($totalPages, $currentPage) {
                  // build your pager
                  }
                  

                  希望能帮助您入门!

                  这篇关于没有 SQL 的 PHP 动态分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 Laravel DB::select 查询中使用分页 下一篇:使用 Jquery、PHP、Mysql 进行 Ajax 分页

                  相关文章

                      • <bdo id='A41l0'></bdo><ul id='A41l0'></ul>

                      <small id='A41l0'></small><noframes id='A41l0'>

                      <legend id='A41l0'><style id='A41l0'><dir id='A41l0'><q id='A41l0'></q></dir></style></legend>
                      <i id='A41l0'><tr id='A41l0'><dt id='A41l0'><q id='A41l0'><span id='A41l0'><b id='A41l0'><form id='A41l0'><ins id='A41l0'></ins><ul id='A41l0'></ul><sub id='A41l0'></sub></form><legend id='A41l0'></legend><bdo id='A41l0'><pre id='A41l0'><center id='A41l0'></center></pre></bdo></b><th id='A41l0'></th></span></q></dt></tr></i><div id='A41l0'><tfoot id='A41l0'></tfoot><dl id='A41l0'><fieldset id='A41l0'></fieldset></dl></div>
                      <tfoot id='A41l0'></tfoot>