GET
一、首先创一个get.php文件(表单)里面内容如下,
<!DOCTYPE html>
<html>
<head>
<title>get</title>
<meta charset="utf-8">
</head>
<body>
<form action="one.php" metho="post">
//通过这个语句把提交的结果传递到one.php文件
<label for="id">账号:</label><input type="text" name="id">
<label for="password">账号:</label><input type="text" name="password">
<input type="submit" name="get" value="提交">
</form>
</body>
</html>
第二、创一个one.php文件,用来接受值,内容如下
<?php
header("content-type:text/html;charset=utf-8");
echo $_GET['id']."<br>";
echo $_GET['password']."<br>";
?>
第三、运行get.php文件,点击提交结果如下
POST
代码与上面基本一样只需要把第一个文件里的method=“get”改成method=“post”,还有把第二个文件里的GET改成POST即可
如果要想明白更多可以看这篇博客,我觉得写得不错
https://blog.csdn.net/u011242029/article/details/50925486