
easyui支持php嗎?
easyui支持php,具體的使用方法是使用easyui來(lái)搭建頁(yè)面結(jié)構(gòu),然后通過(guò)php返回的數(shù)據(jù)進(jìn)行展示即可。
EasyUI是一組基于jQuery的UI插件集合體,EasyUI的目標(biāo)就是幫助web開(kāi)發(fā)者更輕松的打造出功能豐富并且美觀的UI界面。開(kāi)發(fā)者不需要編寫(xiě)復(fù)雜的javascript,也不需要對(duì)css樣式有深入的了解,需要了解的只有一些簡(jiǎn)單的html標(biāo)簽。
下面是一個(gè)easyUI+PHP展示數(shù)據(jù)的例子,供各位參考:
1、首先編寫(xiě)HTML文件
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/color.css"> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/demo/demo.css"> <script type="text/javascript" src="/mine/easyui/jquery.min.js"></script> <script type="text/javascript" src="/mine/easyui/jquery.easyui.min.js"></script> </head> <body> <table id="dg" title="My Users" style="width:550px;height:250px" toolbar="#toolbar" idField="id" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="id" width="50" editor="{type:'validatebox',options:{required:true}}">ID</th> <th field="user_id" width="50" editor="{type:'validatebox',options:{required:true}}">UID</th> <th field="time" width="50" editor="text">TIME</th> <th field="type" width="50" editor="{type:'validatebox',options:{required:'true'}}">TYPE</th> </tr> </thead> </table> <script> $('#dg').datagrid({ url: '/index/index/test2', }); </script> </body> </html>
2、然后編寫(xiě)PHP文件
<?php $result = Db::table('o_attend') ->select(); $arr['total']=sizeof($result); $arr['rows']=$result; echo json_encode($arr); ?>
3、php返回?cái)?shù)據(jù)示例:
{ "total": 2, "rows": [{ "id": 1, "user_id": "1", "time": "1", "type": 1 }, { "id": 2, "user_id": "1", "time": "1", "type": 2 }] }
相關(guān)文章教程推薦:php教程
站長(zhǎng)資訊網(wǎng)