Home >Backend Development >PHP Problem >Does easyui support php?

Does easyui support php?

angryTom
angryTomOriginal
2020-01-27 21:13:062856browse

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:&#39;validatebox&#39;,options:{required:true}}">ID</th>
        <th field="user_id" width="50" editor="{type:&#39;validatebox&#39;,options:{required:true}}">UID</th>
        <th field="time" width="50" editor="text">TIME</th>
        <th field="type" width="50" editor="{type:&#39;validatebox&#39;,options:{required:&#39;true&#39;}}">TYPE</th>
    </tr>
    </thead>
</table>
<script>
    $(&#39;#dg&#39;).datagrid({
        url: &#39;/index/index/test2&#39;,
    });
</script>

</body>
</html>

2. Then write the PHP file

<?php
$result = Db::table(&#39;o_attend&#39;)
            ->select();
$arr[&#39;total&#39;]=sizeof($result);
$arr[&#39;rows&#39;]=$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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn