php接收表单的方法
php 可以通过post、get方法获取到表单提交的数据
获取到的post、get是数组形式的值,需要通过键值来详细获取相应的值
比如: index.php 页面
下面是post方法
<form name="form1" method="post" action="index.php"><input type="text" name="contents" value=""><input type="submit" value="提交"></form><?php//获取表单提交的数据$contents = $_post['contents'];echo $contents;?>
也可以是下面是get方法
<form name="form1" method="get" action="index.php"><input type="text" name="contents" value=""><input type="submit" value="提交"></form><?php//获取表单提交的数据$contents = $_get['contents'];echo $contents;?>
post相对于get方法,更好一些,可以提交大量数据,以及更安全些。
更多php相关知识,请访问!
以上就是php接收表单的方法的详细内容。