今天小编给大家分享的是easyui是否支持PHP,相信很多人都不太了解,为了让大家更加了解easyui,所以给大家总结了以下内容,一起往下看吧。一定会有所收获的哦。

easyui是否支持PHP?

easyui支持php,具体的使用方法是使用easyui来搭建页面结构,然后通过php返回的数据进行展示即可。

EasyUI是一组基于jQuery的UI插件集合体,EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,需要了解的只有一些简单的html标签。

下面是一个easyUI+PHP展示数据的例子,供各位参考:

1、首先编写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、然后编写PHP文件

<?php$result = Db::table('o_attend') ->select();$arr['total']=sizeof($result);$arr['rows']=$result;echo json_encode($arr);?>

3、php返回数据示例:

{ "total": 2, "rows": [{ "id": 1, "user_id": "1", "time": "1", "type": 1 }, { "id": 2, "user_id": "1", "time": "1", "type": 2 }]}

关于easyui是否支持PHP就分享到这里了,当然并不止以上和大家分析的办法,不过小编可以保证其准确性是绝对没问题的。希望以上内容可以对大家有一定的参考价值,可以学以致用。如果喜欢本篇文章,不妨把它分享出去让更多的人看到。