tp5在HTML上添加、修改、删除数据库

xiaoxiao2021-02-28  56

HTML代码

<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <title>教师管理</title> </head> <body> <table> <tr> <th>序号</th> <th>姓名</th> <th>性别</th> <th>邮箱</th> <th>用户名</th> <th>操作</th> </tr> <tr> {volist name = "qianduanjieshou" id = "qiaotou"} <td> {$qiaotou.id}</td> <td> {$qiaotou.name}</td> <td> {$qiaotou.sex}</td> <td> {$qiaotou.email}</td> <td> {$qiaotou.username}</td> <td><a style="margin-right: 10px" href="delete/id/">删除</a><a href="edit/id/">修改</a></td> </tr> {/volist} </table> </body> </html> PHP代码

<?php namespace app\index\controller; use think\Request; use think\Controller; class Tijiao extends Controller { public function index() { return view(); } public function post(){ //前端提交上来的数据 $data['account'] = Request::instance()->param('account'); $data['password'] = Request::instance()->param('password'); //存储提交上来的数据 $res = db('dengru')->insert($data); if($res){ return "提交成功"; }else{ return "提交失败"; } dump($data); } }

转载请注明原文地址: https://www.6miu.com/read-37191.html

最新回复(0)