MVC接收前台传的值(表单传值法)

表单传值法

Html:

  <form action="/Login/Code" method="post">
    <input type="text" name="name" value="" />
    <input type="text" name="name" value="" />
    <button>OK</button>
    </form>

Controller:

这是后台接受前台的数据,主要是通过formcollection这个类

 public ActionResult Code(FormCollection col)
        {
          
            string a = col[0];
            string b = col[1];      
            return Content("OK");  
        }

 

posted @ 2020-08-07 14:51  我的未来方程式i  阅读(173)  评论(0编辑  收藏  举报