一、参考资料:
1.thinkphp: https://www.kancloud.cn/special/thinkphp5_quickstart
2.layui: http://www.layui.com/doc/modules/table.html
二、代码:
主体html
<table id="demo" lay-filter="test"></table>
JS构建:(此处采用自动构建)
<script src="/layui/layui.js"></script>
<script>
layui.use('table', function(){
var table = layui.table;
//第一个实例
table.render({
elem: '#demo'
,height: 315
,url: '/demo/table/user/' //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'username', title: '用户名', width:80}
,{field: 'sex', title: '性别', width:80, sort: true}
,{field: 'city', title: '城市', w