User模块UserAction.class.php
<?php class UserAction extends Action { public function index(){ $m=M('User');//操作的数据库表 $arr=$m->select();//查询数据库 $this->assign('data',$arr);// $this->display(); } /* * 向数据库插入数据 **/ public function add(){ $m=M('User'); $m->username=$_POST['username']; $m->sex=$_POST['sex']; $num=$m->add(); if ($num>0){ $this->success('添加成功','index');//添加成功并返回首页 }else { $this->error('添加失败'); } } /* * 显示添加表单 **/ public function addform(){ $this->display(); } } ?>
首页模板文件index.html
<html> <head> <title></title> <script> function jump(){ window.location='__URL__/addform'; } </script> </head> <body> <table border="1"> <tr> <th>ID号</th> <th>用户名</th> <th>性别</th> <th>操作</th> </tr> <volist name='data' id='vo'> <tr> <td>{$vo.id}</td> <td>{$vo.username}</td> <td>{$vo.sex}</td> <td>删除|修改</td> </tr> </volist> </table> <button onclick="jump()">添加用户</button> </body> </html>
添加表单模板addform.html
<html> <head> <title></title> </head> <body> </body> </html>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
