1、html部分
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form action="/index/index/zhuce" method="post"> <div>代号: <input type="text" name="code" /></div> <div>名称: <input type="text" name="name"/></div> <input type="submit" value="添加" /> </form> </body> </html>
2、控制器部分
<?php namespace appindexcontroller; // 引入系统数据类 use thinkDb; // 引入系统控制器类 use thinkController; class Index extends Controller { public function index() { return view(); } // 表单接口 public function Zhuce() { print_r($_POST); } }
3、提交表单即可
提交后将跳转
-----------------
这样一个超级简单的表单接口就完成了