Home > Article > Backend Development > Does easyui support php?
Does easyui support php?
easyui supports php. The specific method of use is to use easyui to build the page structure, and then display the data returned by php.
EasyUI is a collection of UI plug-ins based on jQuery. The goal of EasyUI is to help web developers more easily create functional and beautiful UI interfaces. Developers do not need to write complex javascript, nor do they need to have an in-depth understanding of css styles. All they need to know are some simple html tags.
The following is an example of easyUI PHP displaying data for your reference:
1. First write the HTML file
<!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. Then write the PHP file
<?php $result = Db::table('o_attend') ->select(); $arr['total']=sizeof($result); $arr['rows']=$result; echo json_encode($arr); ?>
3. PHP return data example:
{ "total": 2, "rows": [{ "id": 1, "user_id": "1", "time": "1", "type": 1 }, { "id": 2, "user_id": "1", "time": "1", "type": 2 }] }
Recommended related article tutorials: php tutorial
The above is the detailed content of Does easyui support php?. For more information, please follow other related articles on the PHP Chinese website!