Front desk - php form automatically built
某草草
某草草 2017-07-05 09:56:04
0
3
861

Thinkphp framework is often used for project development. Each functional module basically requires addition, deletion, modification and query operations. The pages are basically the same, except for the different form fields. However, each module needs to be modified one by one each time. Adding fields and names to the edit list page requires a lot of repetitive work and is very time-consuming.
Sample code:

        <p class="ibox-content">

            <table class="table table-bordered">
                <thead>
                    <tr class="success">
                        <th>id</th>
                        <th>权限名称</th>
                        <th>模块名称</th>
                        <th>控制器名称</th>
                        <th>方法名称</th>
                        <th>上级权限id</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                <foreach name="lists" item="vo" >
                    <tr class="">
                        <td>{$vo.id}</td>
                        <td>{$vo.auth_name}</td>
                        <td>{$vo.module}</td>
                        <td>{$vo.controller}</td>
                        <td>{$vo.action}</td>
                        <td>{$vo.pid}</td>
                        <td><a href="{:U('Rbac/Auth/editC',['id'=>$vo['id']])}" class="btn btn-w-m btn-info">编辑</a>&nbsp<a href="{:U('Rbac/Auth/delC',['id'=>$vo['id']])}" class="btn btn-w-m btn-danger" onclick="return confirm('确定要删除吗?');">删除</a></td>
                    </tr>
                </foreach>

                </tbody>
            </table>

How to automatically generate dynamic forms and lists based on database tables.
How do you deal with this part of the repetitive work when doing projects? Is there any better way or front-end framework that can handle this problem? Best Can you provide a reference code? Thank you all.
I found an idea: to directly generate a form based on the model (database table) configuration, write a configuration file for one database table?

某草草
某草草

reply all(3)
洪涛

I changed it manually

大家讲道理

yii2 officially comes with gii, which can easily generate models, controllers, grud, etc.

ringa_lee

I don’t like GII too much, long-term use is not conducive to improving the coding ability

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!