• 最简单的ThinkPHP实例(2)表单操作


    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、提交表单即可

     

    提交后将跳转

     

    -----------------

    这样一个超级简单的表单接口就完成了

  • 相关阅读:
    Next Permutation
    SpringMVC配置信息
    Servlet详解(转载)
    Length of Last Word
    Maximum Subarray**
    Divide Two Integers
    Generate Parentheses***
    http解码-2
    编码-1
    扫描工具对比
  • 原文地址:https://www.cnblogs.com/mankii/p/15148587.html
Copyright © 2020-2023  润新知