Bootstrap表,无法从PHP文件

时间:2017-11-22 10:47:50

标签: php json html-table bootstrap-table

以下是我要做的事情: 我想使用php文件作为源填充引导表。这是我的代码:

<table id="non_conformites" data-toggle="table">
    <thead>
    <tr>
        <th data-field="date">Date</th>
        <th data-field="conciergerie">Conciergerie</th>
        <th data-field="utilisateur">Utilisateur</th>
        <th data-field="createur">Créateur</th>
        <th data-field="demande">Demande liée</th>
        <th data-field="domaine">Domaine</th>
        <th data-field="gravite">Gravité</th>
        <th data-field="statut">Statut</th>
    </tr>
    </thead>
</table>
<script>
    $(function () {
        $('#non_conformites').bootstrapTable({
            url:'data_ga.php'
        });
    });
</script>

这是我的php文件echo(我使用json_encode()来显示正确的格式):

[
    {
        "date": "2017-11-15 09:21:12",
        "conciergerie": "xx_easywhere",
        "utilisateur": "99XX01",
        "createur": "1",
        "demande": "xx_easywhere_15112017_Gard_1",
        "domaine": null,
        "gravite": "0",
        "statut": "3"
    },
    ...more data...
    {
        "date": "2017-11-16 17:07:43",
        "conciergerie": "xx_easywhere",
        "utilisateur": "99XX01",
        "createur": "",
        "demande": "xx_easywhere_16112017_Lava_5",
        "domaine": "test_maj",
        "gravite": "1",
        "statut": "2"
    }
]

但我的桌子上没有显示任何内容。实际上,我知道我的php文件永远不会被访问,因为如果是,它应该创建一些调试txt文件,而事实并非如此。 当我将上面的数据直接放在其中并将其用作我的表的源时,它可以工作。 所以我可能没有正确使用我的PHP源代码。如果你对我做错了什么有任何线索,我更感兴趣的是:)

0 个答案:

没有答案