整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          HTML 表格及實例

          可以使用 HTML 創建表格。

          實例

          表格

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <p>每個表格由 table 標簽開始。</p>

          <p>每個表格行由 tr 標簽開始。</p>

          <p>每個表格數據由 td 標簽開始。</p>

          <h4>一列:</h4>

          <table border="1">

          <tr>

          <td>100</td>

          </tr>

          </table>

          <h4>一行三列:</h4>

          <table border="1">

          <tr>

          <td>100</td>

          <td>200</td>

          <td>300</td>

          </tr>

          </table>

          <h4>兩行三列:</h4>

          <table border="1">

          <tr>

          <td>100</td>

          <td>200</td>

          <td>300</td>

          </tr>

          <tr>

          <td>400</td>

          <td>500</td>

          <td>600</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          這個例子演示如何在 HTML 文檔中創建表格。

          表格邊框

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>帶有普通的邊框:</h4>

          <table border="1">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          <h4>帶有粗的邊框:</h4>

          <table border="8">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          <h4>帶有很粗的邊框:</h4>

          <table border="15">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示各種類型的表格邊框。

          表格

          表格由 <table> 標簽來定義。每個表格均有若干行(由 <tr> 標簽定義),每行被分割為若干單元格(由 <td> 標簽定義)。字母 td 指表格數據(table data),即數據單元格的內容。數據單元格可以包含文本、圖片、列表、段落、表單、水平線、表格等等。

          <table border="1">

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下:

          row 1, cell 1 row 1, cell 2

          row 2, cell 1 row 2, cell 2

          表格和邊框屬性

          如果不定義邊框屬性,表格將不顯示邊框。有時這很有用,但是大多數時候,我們希望顯示邊框。

          使用邊框屬性來顯示一個帶有邊框的表格:

          <table border="1">

          <tr>

          <td>Row 1, cell 1</td>

          <td>Row 1, cell 2</td>

          </tr>

          </table>

          表格的表頭

          表格的表頭使用 <th> 標簽進行定義。

          大多數瀏覽器會把表頭顯示為粗體居中的文本:

          <table border="1">

          <tr>

          <th>Heading</th>

          <th>Another Heading</th>

          </tr>

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下:

          Heading Another Heading

          row 1, cell 1 row 1, cell 2

          row 2, cell 1 row 2, cell 2

          表格中的空單元格

          在一些瀏覽器中,沒有內容的表格單元顯示得不太好。如果某個單元格是空的(沒有內容),瀏覽器可能無法顯示出這個單元格的邊框。

          <table border="1">

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td></td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          表格中的空單元格

          注意:這個空的單元格的邊框沒有被顯示出來。為了避免這種情況,在空單元格中添加一個空格占位符,就可以將邊框顯示出來。

          <table border="1">

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>&nbsp;</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器中顯示如下:

          row 1, cell 1 row 1, cell 2

          row 2, cell 2

          更多實例

          沒有邊框的表格

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>這個表格沒有邊框:</h4>

          <table>

          <tr>

          <td>100</td>

          <td>200</td>

          <td>300</td>

          </tr>

          <tr>

          <td>400</td>

          <td>500</td>

          <td>600</td>

          </tr>

          </table>

          <h4>這個表格也沒有邊框:</h4>

          <table border="0">

          <tr>

          <td>100</td>

          <td>200</td>

          <td>300</td>

          </tr>

          <tr>

          <td>400</td>

          <td>500</td>

          <td>600</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示一個沒有邊框的表格。

          表格中的表頭(Heading)

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>表頭:</h4>

          <table border="1">

          <tr>

          <th>姓名</th>

          <th>電話</th>

          <th>電話</th>

          </tr>

          <tr>

          <td>Bill Gates</td>

          <td>555 77 854</td>

          <td>555 77 855</td>

          </tr>

          </table>

          <h4>垂直的表頭:</h4>

          <table border="1">

          <tr>

          <th>姓名</th>

          <td>Bill Gates</td>

          </tr>

          <tr>

          <th>電話</th>

          <td>555 77 854</td>

          </tr>

          <tr>

          <th>電話</th>

          <td>555 77 855</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何顯示表格表頭。

          空單元格

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <table border="1">

          <tr>

          <td>Some text</td>

          <td>Some text</td>

          </tr>

          <tr>

          <td></td>

          <td>Some text</td>

          </tr>

          </table>

          <p>正如您看到的,其中一個單元沒有邊框。這是因為它是空的。在該單元中插入一個空格后,仍然沒有邊框。</p>

          <p>我們的技巧是在單元中插入一個 no-breaking 空格。</p>

          <p>no-breaking 空格是一個字符實體。如果您不清楚什么是字符實體,請閱讀關于字符實體的章節。</p>

          <p>no-breaking 空格由和號開始 ("&"),然后是字符"nbsp",并以分號結尾(";")。</p>

          </body>

          </html>

          [/demo]

          本例展示如何使用 "&nbsp;" 處理沒有內容的單元格。

          帶有標題的表格

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>這個表格有一個標題,以及粗邊框:</h4>

          <table border="6">

          <caption>我的標題</caption>

          <tr>

          <td>100</td>

          <td>200</td>

          <td>300</td>

          </tr>

          <tr>

          <td>400</td>

          <td>500</td>

          <td>600</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示一個帶標題 (caption) 的表格

          跨行或跨列的表格單元格

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>橫跨兩列的單元格:</h4>

          <table border="1">

          <tr>

          <th>姓名</th>

          <th colspan="2">電話</th>

          </tr>

          <tr>

          <td>Bill Gates</td>

          <td>555 77 854</td>

          <td>555 77 855</td>

          </tr>

          </table>

          <h4>橫跨兩行的單元格:</h4>

          <table border="1">

          <tr>

          <th>姓名</th>

          <td>Bill Gates</td>

          </tr>

          <tr>

          <th rowspan="2">電話</th>

          <td>555 77 854</td>

          </tr>

          <tr>

          <td>555 77 855</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何定義跨行或跨列的表格單元格。

          表格內的標簽

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <table border="1">

          <tr>

          <td>

          <p>這是一個段落。</p>

          <p>這是另一個段落。</p>

          </td>

          <td>這個單元包含一個表格:

          <table border="1">

          <tr>

          <td>A</td>

          <td>B</td>

          </tr>

          <tr>

          <td>C</td>

          <td>D</td>

          </tr>

          </table>

          </td>

          </tr>

          <tr>

          <td>這個單元包含一個列表:

          <ul>

          <li>蘋果</li>

          <li>香蕉</li>

          <li>菠蘿</li>

          </ul>

          </td>

          <td>HELLO</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何顯示在不同的元素內顯示元素。

          單元格邊距(Cell padding)

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>沒有 cellpadding:</h4>

          <table border="1">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          <h4>帶有 cellpadding:</h4>

          <table border="1"

          cellpadding="10">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何使用 Cell padding 來創建單元格內容與其邊框之間的空白。

          單元格間距(Cell spacing)

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>沒有 cellspacing:</h4>

          <table border="1">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          <h4>帶有 cellspacing:</h4>

          <table border="1"

          cellspacing="10">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何使用 Cell spacing 增加單元格之間的距離。

          向表格添加背景顏色或背景圖像

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>背景顏色:</h4>

          <table border="1"

          bgcolor="red">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          <h4>背景圖像:</h4>

          <table border="1"

          background="./imagecopy1234567890/test.gif">

          <tr>

          <td>First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td>Second</td>

          <td>Row</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何向表格添加背景。

          向表格單元添加背景顏色或者背景圖像

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <h4>單元背景:</h4>

          <table border="1">

          <tr>

          <td bgcolor="red">First</td>

          <td>Row</td>

          </tr>

          <tr>

          <td

          background="./imagecopy1234567890/test.gif">

          Second</td>

          <td>Row</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何向一個或者更多表格單元添加背景。

          在表格單元中排列內容

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <table width="400" border="1">

          <tr>

          <th align="left">消費項目....</th>

          <th align="right">一月</th>

          <th align="right">二月</th>

          </tr>

          <tr>

          <td align="left">衣服</td>

          <td align="right">1.10</td>

          <td align="right">.20</td>

          </tr>

          <tr>

          <td align="left">化妝品</td>

          <td align="right">.00</td>

          <td align="right">.45</td>

          </tr>

          <tr>

          <td align="left">食物</td>

          <td align="right">0.40</td>

          <td align="right">0.00</td>

          </tr>

          <tr>

          <th align="left">總計</th>

          <th align="right">01.50</th>

          <th align="right">4.65</th>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何使用 "align" 屬性排列單元格內容,以便創建一個美觀的表格。

          框架(frame)屬性

          [demo]

          <html>

          <head>

          <meta charset="UTF-8">

          </head>

          <body>

          <p><b>注釋:</b>frame 屬性無法在 Internet Explorer 中正確地顯示。</p>

          <p>Table with frame="box":</p>

          <table frame="box">

          <tr>

          <th>Month</th>

          <th>Savings</th>

          </tr>

          <tr>

          <td>January</td>

          <td>0</td>

          </tr>

          </table>

          <p>Table with frame="above":</p>

          <table frame="above">

          <tr>

          <th>Month</th>

          <th>Savings</th>

          </tr>

          <tr>

          <td>January</td>

          <td>0</td>

          </tr>

          </table>

          <p>Table with frame="below":</p>

          <table frame="below">

          <tr>

          <th>Month</th>

          <th>Savings</th>

          </tr>

          <tr>

          <td>January</td>

          <td>0</td>

          </tr>

          </table>

          <p>Table with frame="hsides":</p>

          <table frame="hsides">

          <tr>

          <th>Month</th>

          <th>Savings</th>

          </tr>

          <tr>

          <td>January</td>

          <td>0</td>

          </tr>

          </table>

          <p>Table with frame="vsides":</p>

          <table frame="vsides">

          <tr>

          <th>Month</th>

          <th>Savings</th>

          </tr>

          <tr>

          <td>January</td>

          <td>0</td>

          </tr>

          </table>

          </body>

          </html>

          [/demo]

          本例演示如何使用 "frame" 屬性來控制圍繞表格的邊框。

          表格標簽

          表格 描述

          <table> 定義表格

          <caption> 定義表格標題。

          <th> 定義表格的表頭。

          <tr> 定義表格的行。

          <td> 定義表格單元。

          <thead> 定義表格的頁眉。

          <tbody> 定義表格的主體。

          <tfoot> 定義表格的頁腳。

          <col> 定義用于表格列的屬性。

          <colgroup> 定義表格列的組。

          TML 表格實例:

          First NameLast NamePoints
          JillSmith50
          EveJackson94
          JohnDoe80
          AdamJohnson67

          在線實例

          表格

          這個例子演示如何在 HTML 文檔中創建表格。

          HTML 表格

          表格由 <table> 標簽來定義。每個表格均有若干行(由 <tr> 標簽定義),每行被分割為若干單元格(由 <td> 標簽定義)。字母 td 指表格數據(table data),即數據單元格的內容。數據單元格可以包含文本、圖片、列表、段落、表單、水平線、表格等等。

          表格實例

          <table border="1">

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下::

          row 1, cell 1row 1, cell 2
          row 2, cell 1row 2, cell 2

          HTML 表格和邊框屬性

          如果不定義邊框屬性,表格將不顯示邊框。有時這很有用,但是大多數時候,我們希望顯示邊框。

          使用邊框屬性來顯示一個帶有邊框的表格:

          <table border="1">

          <tr>

          <td>Row 1, cell 1</td>

          <td>Row 1, cell 2</td>

          </tr>

          </table>

          HTML 表格表頭

          表格的表頭使用 <th> 標簽進行定義。

          大多數瀏覽器會把表頭顯示為粗體居中的文本:

          <table border="1">

          <tr>

          <th>Header 1</th>

          <th>Header 2</th>

          </tr>

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下:

          Header 1Header 2
          row 1, cell 1row 1, cell 2
          row 2, cell 1row 2, cell 2

          更多實例

          沒有邊框的表格

          本例演示一個沒有邊框的表格。

          表格中的表頭(Heading)

          本例演示如何顯示表格表頭。

          帶有標題的表格

          本例演示一個帶標題 (caption) 的表格

          跨行或跨列的表格單元格

          本例演示如何定義跨行或跨列的表格單元格。

          表格內的標簽

          本例演示如何顯示在不同的元素內顯示元素。

          單元格邊距(Cell padding)

          本例演示如何使用 Cell padding 來創建單元格內容與其邊框之間的空白。

          單元格間距(Cell spacing)

          本例演示如何使用 Cell spacing 增加單元格之間的距離。

          HTML 表格標簽

          標簽描述
          <table>定義表格
          <th>定義表格的表頭
          <tr>定義表格的行
          <td>定義表格單元
          <caption>定義表格標題
          <colgroup>定義表格列的組
          <col>定義用于表格列的屬性
          <thead>定義表格的頁眉
          <tbody>定義表格的主體
          <tfoot>定義表格的頁腳

          如您還有不明白的可以在下面與我留言或是與我探討QQ群308855039,我們一起飛!

          ootstrap Table 封裝了一套完善的數據表格組件,把下面的代碼復制一下估計你需要的基本功能都有了,沒有的再看看手冊看著我給的實例也能很快的熟悉了。

          客戶端

          <!DOCTYPE html>
          <html>
          <head>
           <meta charset="UTF-8">
           <title>Bootstrap-Table</title>
           <link rel="stylesheet" />
           <link rel="stylesheet" href="assets/bootstrap-table.css"/>
           <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
          </head>
          <body>
           <div>
           <div>
           <div class="col-*-12">
           
           <div id="toolbar">
           <div class="btn btn-primary" data-toggle="modal" data-target="#addModal">添加記錄</div>
           </div>
           
           <table id="mytab" class="table table-hover"></table>
           
           <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-hidden="true">
           <div class="modal-dialog">
           <div class="modal-content">
           <div class="modal-header">
           <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
           ×
           </button>
           <h4 class="modal-title" id="myModalLabel">添加記錄</h4>
           </div>
           <div class="modal-body">
           <form role="form" action="javascript:void(0)">
           <div class="form-group">
           <input type="text" class="form-control" id="name" placeholder="請輸入名稱">
           </div>
           <div class="form-group">
           <input type="text" class="form-control" id="age" placeholder="請輸入年齡">
           </div>
           </form>
           </div>
           <div class="modal-footer">
           <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
           <button type="button" class="btn btn-primary" id="addRecord">提交</button>
           </div>
           </div>
           </div>
           </div>
           
           </div>
           </div>
           </div>
           <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
           <script src="http://apps.bdimg.com/libs/bootstrap/3.3.4/js/bootstrap.min.js"></script>
           <script src="assets/bootstrap-table.js"></script>
           <script src="assets/bootstrap-table-zh-CN.js"></script>
           <script type="text/javascript">
           $(function() {
           //根據窗口調整表格高度
           $(window).resize(function() {
           $('#mytab').bootstrapTable('resetView', {
           height: tableHeight()
           })
           })
           
           $('#mytab').bootstrapTable({
           url: "index.php",//數據源
           dataField: "rows",//服務端返回數據鍵值 就是說記錄放的鍵值是rows,分頁時使用總記錄數的鍵值為total
           height: tableHeight(),//高度調整
           search: true,//是否搜索
           pagination: true,//是否分頁
           pageSize: 20,//單頁記錄數
           pageList: [5, 10, 20, 50],//分頁步進值
           sidePagination: "server",//服務端分頁
           contentType: "application/x-www-form-urlencoded",//請求數據內容格式 默認是 application/json 自己根據格式自行服務端處理
           dataType: "json",//期待返回數據類型
           method: "post",//請求方式
           searchAlign: "left",//查詢框對齊方式
           queryParamsType: "limit",//查詢參數組織方式
           queryParams: function getParams(params) {
           //params obj
           params.other = "otherInfo";
           return params;
           },
           searchOnEnterKey: false,//回車搜索
           showRefresh: true,//刷新按鈕
           showColumns: true,//列選擇按鈕
           buttonsAlign: "left",//按鈕對齊方式
           toolbar: "#toolbar",//指定工具欄
           toolbarAlign: "right",//工具欄對齊方式
           columns: [
           {
           title: "全選",
           field: "select",
           checkbox: true,
           width: 20,//寬度
           align: "center",//水平
           valign: "middle"http://垂直
           },
           {
           title: "ID",//標題
           field: "id",//鍵名
           sortable: true,//是否可排序
           order: "desc"http://默認排序方式
           },
           {
           field: "name",
           title: "NAME",
           sortable: true,
           titleTooltip: "this is name"
           },
           {
           field: "age",
           title: "AGE",
           sortable: true,
           },
           {
           field: "info",
           title: "INFO[using-formatter]",
           formatter: 'infoFormatter',//對本列數據做格式化
           }
           ],
           onClickRow: function(row, $element) {
           //$element是當前tr的jquery對象
           $element.css("background-color", "green");
           },//單擊row事件
           locale: "zh-CN"http://中文支持,
           detailView: false, //是否顯示詳情折疊
           detailFormatter: function(index, row, element) {
           var html = '';
           $.each(row, function(key, val){
           html += "<p>" + key + ":" + val + "</p>"
           });
           return html;
           }
           });
           
           $("#addRecord").click(function(){
           alert("name:" + $("#name").val() + " age:" +$("#age").val());
           });
           })
           
           function tableHeight() {
           return $(window).height() - 50;
           }
           /**
           * 列的格式化函數 在數據從服務端返回裝載前進行處理
           * @param {[type]} value [description]
           * @param {[type]} row [description]
           * @param {[type]} index [description]
           * @return {[type]} [description]
           */
           function infoFormatter(value, row, index)
           {
           return "id:" + row.id + " name:" + row.name + " age:" + row.age;
           }
           </script>
          </body>
          </html>
          

          服務端:

          <?php
          /**
           * 服務端模擬數據
           */
           
          //前端期望數據為json
          header("Content-Type:application/json;charset=utf-8");
          //post 請求 請求內容類型為 application/x-www-form-urlencoded 如果是 application/json 則需要另行處理 $_POST 數組不會被填充
           
          //為了保持模擬的數據
          session_start();
           
          if ($_SESSION['emulate_data']) {
           //已生成
          } else {
           $list = [];
           //第一次會模擬個數據
           for($i = 1; $i < 50; $i ++) {
           $list[] = [
           "id" => $i,
           "name" => substr(str_shuffle(implode('', range('a', 'z'))), 0, 5),
           "age" => mt_rand(10, 30)
           ];
           }
           $_SESSION['emulate_data'] = $list;
          }
           
          $list_temp = [];
          //檢索
          if (isset($_POST['search']) && !empty($_POST['search'])) {
           foreach ($_SESSION['emulate_data'] as $key => $row) {
           if (strpos($row['name'], $_POST['search']) !== false
           || strpos($row['age'], $_POST['search']) !== false) {
           $list_temp[] = $_SESSION['emulate_data'][$key];
           }
           }
          } else {
           $list_temp = $_SESSION['emulate_data'];
          }
          //排序
          if (isset($_POST['sort'])) {
           $temp = [];
           foreach ($list_temp as $row) {
           $temp[] = $row[$_POST['sort']];
           }
           //php的多維排序
           array_multisort($temp,
           $_POST['sort'] == 'name' ? SORT_STRING : SORT_NUMERIC,
           $_POST['order'] == 'asc' ? SORT_ASC : SORT_DESC,
           $list_temp
           );
          }
           
          //分頁時需要獲取記錄總數,鍵值為 total
          $result["total"] = count($list_temp);
          //根據傳遞過來的分頁偏移量和分頁量截取模擬分頁 rows 可以根據前端的 dataField 來設置
          $result["rows"] = array_slice($list_temp, $_POST['offset'], $_POST['limit']);
           
          echo json_encode($result);
          

          如上的json數據(當然我前臺設置的期望數據類型是json,php 直接encode一個 ["total"=>200, "rows"=>[[],[],][,][,]]的數組就完事了,方便)

          2、且其請求后端是傳遞的內容格式默認為 application/json 我自己習慣用方便的 x-www-form-urlencoded

          如果大家還想深入學習,可以私信小明,為大家提供一套前端的學習資料:

          以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。


          主站蜘蛛池模板: 一区免费在线观看| 无码AV一区二区三区无码| 国产成人无码一区二区在线观看| 午夜爽爽性刺激一区二区视频| 亚洲精品色播一区二区| 国产在线视频一区二区三区 | 国产精品一区三区| 国产一区二区视频在线观看| 一区二区三区四区精品视频| 99在线精品一区二区三区| 精品乱人伦一区二区| 无码国产精品一区二区免费式芒果 | 国产乱人伦精品一区二区在线观看| 亚洲爆乳精品无码一区二区| 精品福利一区3d动漫| 国产一区二区三区久久精品| 亚洲av无码片vr一区二区三区| 国产一区二区三区不卡在线观看| 亚洲熟女少妇一区二区| 日韩一区二区三区射精| 奇米精品一区二区三区在| 无码av免费毛片一区二区| 日韩精品无码人妻一区二区三区| 精品一区二区三区免费毛片爱| 国产精品亚洲一区二区三区久久| 日韩免费观看一区| 国产嫖妓一区二区三区无码| 一区二区免费视频| 国产高清精品一区| 亚洲AV一区二区三区四区| 国产一区二区三区不卡观| 波多野结衣在线观看一区| 亚洲va乱码一区二区三区| 国产亚洲欧洲Aⅴ综合一区| 狠狠做深爱婷婷久久综合一区| 一区二区三区观看免费中文视频在线播放| 国产中文字幕一区| 亚洲丶国产丶欧美一区二区三区| 亚洲av无码一区二区三区乱子伦| 精品一区二区三区免费毛片| 无码福利一区二区三区|