当前位置:首页 > PHP教程 > PHP常见问题

Laravel实现表单提交

首先,先做一个简单的表单页面

<html>
	<head>
	</head>
	<body>
		<form action="/submit" method="post">
			<input type="text" name="a"></input>
			<input type="text" name="b"></input>
			<input type="text" name="c"></input>
			<input type="submit"></input>
		</form>
	</body>
<html>

编辑一条路由

route::post('/submit','formcontroller@store');

创建一个控制器

<?php

namespace apphttpcontrollers;

//use illuminatehttprequest;

use apphttprequests;
use request;

class formcontroller extends controller
{
  public function store(){
		//var_dump(request::all());
		$input=request::all();
		echo $input['a'].php_eol;
		echo $input['b'].php_eol;
		echo $input['c'].php_eol;
	}
}

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!