温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

easyui支持php吗

发布时间:2021-09-14 18:10:59 来源:亿速云 阅读:146 作者:chen 栏目:编程语言

本篇内容介绍了“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:'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吗”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI