首頁  >  文章  >  後端開發  >  easyui支援php嗎?

easyui支援php嗎?

angryTom
angryTom原創
2020-01-27 21:13:062780瀏覽

easyui支援php嗎?

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:&#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、然後寫PHP檔案

<?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回傳資料範例:

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

相關文章教學推薦:php教學

以上是easyui支援php嗎?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn