【问题标题】:bootstrap table data url populate with php引导表数据 url 填充 php
【发布时间】:2016-05-15 19:35:10
【问题描述】:

我有一个 bottstrap html 表:

<table data-toggle="table" data-url="../../scripts/tags/s_displaytags.php"  data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-select-item-name="toolbar1" data-pagination="true" data-sort-name="TagName" data-sort-order="desc">
<thead>
  <tr>
  <th data-field="SerialNumber" data-sortable="true">Serial #</th>
  <th data-field="TagName" data-sortable="true">Tag Name</th>
  <th data-field="CreatedBy"  data-sortable="true">Created By</th>
  </tr>
</thead>
</table>

我正在尝试使用 PHP 脚本 s_displaytags.php 填充它。目前我正在测试它,所以代码是:

<?PHP
$ArrayValue = array();
$ArrayValue['SerialNumber'] = 1; 
$ArrayValue['TagName'] = 'test'; 
$ArrayValue['CreatedBy'] = 50; 

echo json_encode($ArrayValue);
?>

我的 HTML 页面已加载,但表格值未加载。

我目前没有使用任何功能。它只是一个普通的 PHP 文件,返回一个结果行编码的 JSON。

【问题讨论】:

  • 你可能想看看here
  • @sjsam - 感谢您的链接。我看到了这个链接,我也在做同样的事情,但它似乎不起作用。还有其他建议吗?
  • @sjsam - 我希望 PHP 脚本直接填充表格。我不想创建中间 json 文件,因为我已经将数组编码为 JSON

标签: php json twitter-bootstrap


【解决方案1】:

所以我只是改变了 echo json_encode($ArrayValue);回显 json_encode(array($ArrayValue));并且成功了。

【讨论】:

    猜你喜欢
    • 2018-06-15
    • 2014-11-05
    • 1970-01-01
    • 1970-01-01
    • 2021-02-18
    • 2015-02-23
    • 2013-01-26
    • 1970-01-01
    • 2012-12-29
    相关资源
    最近更新 更多